//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
Ability | abilcode | Yes | |
d | dialog | No | |
Index | integer | No | |
Item | itemcode | Yes | |
LvlAb | integer | No | |
point | location | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library CasterSystem initializer InitCasterSystem needs TimerSafety, GameCache
//******************************************************************************************
//*
//* emjlr3's Caster System
//*
//*
//* Utility functions that I make to keep my spell making simpler!
//* Many things are documented and can easily be used by others if
//* they so choose. Enjoy.
//*
//* Requires:
//* - "Game Cache" and "Timer Safety" triggers copied to your map
//* - A caster dummy unit like the one found in this map
//*
//******************************************************************************************
//=============================================================================================================================
// Configuration :
//
globals
// Your dummy casters unit type rawcode, found be pressing Ctrl+d in the object editor
constant integer CasterUnitId = 'n000'
// Medivh's Crow form ability, which only need be changed if you made changes to the
// base one, in which case create a new one, set it's values to default and use it here
constant integer FlyTrick = 'Amrf'
// Speed of repeating timers used when the option is not given
constant real TimeOut = .03
// Max collision size of units in your map
constant real CollisionSize = 55.
// Number of casters to create initially when the game starts
constant integer InitialCasters = 10
endglobals
//=============================================================================================================================
// Caster System functions. Don't mess down here unless you know what you are doing!!!
globals
private unit Caster = null
private group Casters = null
private real Game_MaxX
private real Game_MinX
private real Game_MaxY
private real Game_MinY
private timer gametime = null
endglobals
//=============================================================================================================================
// Safe unit movement around your map, no more crashes from guys going off the edge
private function SetUpSafeXY takes nothing returns nothing
set Game_MaxX = GetRectMaxX(bj_mapInitialPlayableArea)-50.
set Game_MinX = GetRectMinX(bj_mapInitialPlayableArea)+50.
set Game_MaxY = GetRectMaxY(bj_mapInitialPlayableArea)-50.
set Game_MinY = GetRectMinY(bj_mapInitialPlayableArea)+50.
endfunction
// Check if your x location is safe, else return a safe one
function SafeX takes real x returns real
if x<Game_MinX then
return Game_MinX
elseif x>Game_MaxX then
return Game_MaxX
endif
return x
endfunction
// Check if your y location is safe, else return a safe one
function SafeY takes real y returns real
if y<Game_MinY then
return Game_MinY
elseif y>Game_MaxY then
return Game_MaxY
endif
return y
endfunction
// Move your units with either or these simple functions
function MoveUnit takes unit u, real x, real y, boolean control returns nothing
if control then
call SetUnitX(u,SafeX(x))
call SetUnitY(u,SafeY(y))
else
call SetUnitPosition(u,SafeX(x),SafeY(y))
endif
endfunction
function MoveUnitLoc takes unit u, location l, boolean control returns nothing
call MoveUnit(u,GetLocationX(l),GetLocationY(l), control)
endfunction
function MoveUnitPP takes unit u, real dist, real ang, boolean control returns nothing
call MoveUnit(u,GetUnitX(u)+dist*Cos(ang*.01745),GetUnitY(u)+dist*Sin(ang*.01745),control)
endfunction
//=============================================================================================================================
// Creating casters and using them
function CreateCaster takes real x, real y returns unit
set Caster = CreateUnit( Player(15), CasterUnitId, x ,y ,0.)
call UnitAddAbility(Caster, 'Aloc')
call UnitAddAbility(Caster, FlyTrick)
call UnitRemoveAbility(Caster, FlyTrick)
return Caster
endfunction
// Loads the caster system for use, called by the system
private function InitCasterSystem takes nothing returns nothing
local integer i = 0
set Casters = CreateGroup()
loop
exitwhen i==InitialCasters
set Caster = CreateCaster(0.,0.)
call GroupAddUnit(Casters,Caster)
set i = i + 1
endloop
call SetUpSafeXY()
set gametime = CreateTimer()
call TimerStart(gametime,1000000.0,false,null)
endfunction
// Grab a caster for usage, use an integer of 0 for no ability
function GetCaster takes player p, real x, real y, integer abil returns unit
set Caster = FirstOfGroup(Casters)
if Caster == null then
set Caster = CreateCaster(0.,0.)
endif
call GroupRemoveUnit(Casters,Caster)
call SetUnitState(Caster, UNIT_STATE_MANA, 1000)
call SetUnitOwner(Caster,p,false)
if abil!=0 then
call UnitAddAbility(Caster,abil)
endif
call SetUnitPosition(Caster,SafeX(x),SafeY(y))
return Caster
endfunction
// Release a caster immediatly, use an integr of 0 for no ability
function EndCaster takes unit caster, integer abil returns nothing
if GetWidgetLife(caster)>.405 then
if abil!=0 then
call UnitRemoveAbility(caster,abil)
endif
call SetUnitOwner( caster, Player(15), true)
call SetUnitVertexColor( caster, 255,255,255,255)
call SetUnitScale( caster, 1,1,1)
call SetUnitTimeScale( caster, 1)
call SetUnitFlyHeight( caster, 0,0)
call UnitAddAbility(caster, 'Aloc')
call GroupAddUnit(Casters, caster)
endif
endfunction
private struct end_caster
unit u
integer abil
endstruct
private function EndCasterTimed_Child takes nothing returns nothing
local timer t = GetExpiredTimer()
local end_caster dat = GetData(t)
call EndCaster(dat.u,dat.abil)
call dat.destroy()
call EndTimer(t)
endfunction
// Release a caster after a short duration
function EndCasterTimed takes unit u, integer abil, real time returns nothing
local timer t = NewTimer()
local end_caster dat = end_caster.create()
set dat.u = u
set dat.abil = abil
call SetData(t,dat)
call TimerStart(t,time,false,function EndCasterTimed_Child)
endfunction
//=============================================================================================================================
// A few simple guys I use all too often
// Angle between units and reals
function ABPXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1))*57.29583
endfunction
function ABU takes unit a, unit b returns real
return 57.29583 * Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b) - GetUnitX(a))
endfunction
// Removing triggers and timers, safely and easily
function ClearTrig takes trigger trig returns nothing
if trig!=null then
call DisableTrigger(trig)
call FlushStoredMission(cscache,I2S(H2I(trig)))
call DestroyTrigger(trig)
endif
endfunction
function ClearTim takes timer t returns nothing
if t!=null then
call PauseTimer(t)
call FlushStoredMission(cscache,I2S(H2I(t)))
call DestroyTimer(t)
endif
endfunction
// Distance between locs and reals
function DBPXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
endfunction
function DBU takes unit a, unit b returns real
return SquareRoot(Pow(GetUnitX(b) - GetUnitX(a), 2) + Pow(GetUnitY(b)-GetUnitY(a),2))
endfunction
// Killing trees inside of a rect
globals
private rect tree_rect = null
endglobals
private function KillTrees_Child takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
function KillTrees takes real x, real y, real radius returns nothing
set tree_rect = Rect(x - radius,y - radius,x + radius,y + radius)
call EnumDestructablesInRect(tree_rect,null,function KillTrees_Child)
endfunction
// Easier function to display text to Player(1)
function Msg takes string s returns nothing
call DisplayTextToPlayer(Player(1),0.,0.,s)
endfunction
// Preload abilities to remove first cast lag
function PreLoadAbil takes integer abil returns nothing
set Caster = CreateCaster(0.,0.)
call UnitAddAbility(Caster,abil)
call EndCaster(Caster,abil)
endfunction
//=============================================================================================================================
// Now to the big guns :)
// Damage enemies in an area
globals
private group dam_grp = CreateGroup()
endglobals
function FilterIsEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>.405
endfunction
function DamageEnemiesArea takes unit damageUnit, real radius, real x, real y, real amount, attacktype attackType, damagetype damageType returns nothing
local unit u
set bj_groupEnumOwningPlayer = GetOwningPlayer(damageUnit)
call GroupEnumUnitsInRange(dam_grp, x, y, radius, Condition(function FilterIsEnemy))
loop
set u = FirstOfGroup(dam_grp)
exitwhen u == null
call GroupRemoveUnit(dam_grp,u)
call UnitDamageTarget(damageUnit,u,amount,false,false,attackType,damageType,null)
endloop
endfunction
// A better alternative to the base PolledWait
function PolledWait2 takes real duration returns nothing
local real timeRemaining
local real st = TimerGetElapsed(gametime)
if duration > 0. then
loop
set timeRemaining = duration - TimerGetElapsed(gametime) + st
exitwhen timeRemaining <= 0
if timeRemaining > 2.00 then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(0.0)
endif
endloop
endif
endfunction
// Slides a unit over a period of time, from an initial speed to a final speed
private struct SlideUnitGlobal
unit u
real init
real dec
real time
real cos
real sin
effect sfx
method onDestroy takes nothing returns nothing
call DestroyEffect(.sfx)
endmethod
endstruct
globals
private timer SlideUnitTimer = CreateTimer()
private integer SlideTotal = 0
private SlideUnitGlobal array SlideStructArray
endglobals
function SlideUnitTimed_Child takes nothing returns nothing
local integer i = 1
local SlideUnitGlobal dat
local real x
local real y
loop
exitwhen i > SlideTotal
set dat = SlideStructArray[i]
if GetWidgetLife(dat.u)>.405 and dat.init>0 and dat.time>TimeOut then
set x = GetUnitX(dat.u)+dat.init*dat.cos
set y = GetUnitY(dat.u)+dat.init*dat.sin
call SetUnitPosition(dat.u,SafeX(x),SafeY(y))
set dat.init = dat.init - dat.dec
set dat.time = dat.time - TimeOut
else
call dat.destroy()
set SlideStructArray[i] = SlideStructArray[SlideTotal]
set SlideTotal = SlideTotal - 1
set i = i - 1
endif
set i = i + 1
endloop
if SlideTotal==0 then
call PauseTimer(SlideUnitTimer)
endif
endfunction
function SlideUnitTimed takes unit toslide, real duration, real initSpeed, real finalSpeed, real angle returns nothing
local SlideUnitGlobal dat = SlideUnitGlobal.create()
set dat.u = toslide
set dat.init = initSpeed
set dat.dec = (initSpeed-finalSpeed)/((duration/TimeOut)-1)
set dat.cos = Cos(angle*.01745)
set dat.sin = Sin(angle*.01745)
set dat.time = duration
set dat.sfx = AddSpecialEffectTarget("sfx\\SlideDust.mdx",dat.u,"origin")
if SlideTotal==0 then
call TimerStart(SlideUnitTimer, TimeOut, true, function SlideUnitTimed_Child)
endif
set SlideTotal = SlideTotal + 1
set SlideStructArray[SlideTotal] = dat
endfunction
// Adds a fading text tag to reals or over a unit
// Integers from 0-255 are to be used
function TextTag takes string text, real x, real y, integer red, integer green, integer blue, integer alpha, real velocity, real duration returns nothing
local texttag t = CreateTextTag()
call SetTextTagText(t, text, 0.025)
call SetTextTagPos(t, x, y, 0.)
call SetTextTagColor(t, red, green, blue, alpha)
call SetTextTagVelocity(t, 0, velocity)
call SetTextTagVisibility(t, true)
call SetTextTagFadepoint(t, 2)
call SetTextTagLifespan(t, duration)
call SetTextTagPermanent(t, false)
set t = null
endfunction
function TextTagUnit takes string text, unit targ, integer red, integer green, integer blue, integer alpha, real velocity, real duration returns nothing
local texttag t = CreateTextTag()
call SetTextTagText(t, text, 0.025)
call SetTextTagPosUnit(t, targ,15)
call SetTextTagColor(t, red, green, blue, alpha)
call SetTextTagVelocity(t, 0, velocity)
call SetTextTagVisibility(t, true)
call SetTextTagFadepoint(t, 2)
call SetTextTagLifespan(t, duration)
call SetTextTagPermanent(t, false)
set t = null
endfunction
function BountyTextTag takes string text, unit targ, player p returns nothing
local texttag t = CreateTextTag()
call SetTextTagText(t, text, 0.025)
call SetTextTagPosUnit(t, targ,0)
call SetTextTagColor(t, 255, 220, 0, 255)
call SetTextTagVelocity(t, 0, .03)
call SetTextTagVisibility(t, GetLocalPlayer()==p)
call SetTextTagFadepoint(t, 2.)
call SetTextTagLifespan(t, 3.)
call SetTextTagPermanent(t, false)
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MiscFunctions needs TimerSafety
//==================================================================================================
// Custom end game stuff
globals
private trigger VictoryTrigger = CreateTrigger()
private boolean VictoryEnabled = false
private trigger DefeatTrigger = CreateTrigger()
private boolean DefeatEnabled = false
endglobals
function DefeatPlayer takes player p returns nothing
local dialog d = DialogCreate()
call RemovePlayer(p,PLAYER_GAME_RESULT_DEFEAT)
set bj_changeLevelShowScores = true
call DialogSetMessage(d,"Defeat!")
call TriggerRegisterDialogButtonEvent(DefeatTrigger,DialogAddButton(d,"Quit Game",GetLocalizedHotkey("GAMEOVER_QUIT_MISSION")))
if DefeatEnabled==false then
call TriggerAddAction(DefeatTrigger,function CustomDefeatQuitBJ)
set DefeatEnabled = true
endif
call DialogDisplay(p,d,true)
if GetLocalPlayer()==p then
call StartSound(bj_defeatDialogSound)
call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_UI, 1.)
endif
set d = null
endfunction
function VictoryPlayer takes player p returns nothing
local dialog d = DialogCreate()
call RemovePlayer(p,PLAYER_GAME_RESULT_VICTORY)
set bj_changeLevelShowScores = true
call DialogSetMessage(d,GetLocalizedString("GAMEOVER_VICTORY_MSG"))
call TriggerRegisterDialogButtonEvent(VictoryTrigger,DialogAddButton(d,"Quit Game",GetLocalizedHotkey("GAMEOVER_QUIT_MISSION")))
if VictoryEnabled==false then
call TriggerAddAction(VictoryTrigger,function CustomVictoryQuitBJ)
set VictoryEnabled = true
endif
call DialogDisplay(p,d,true)
if GetLocalPlayer()==p then
call StartSound(bj_victoryDialogSound)
call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_UI, 1.)
endif
set d = null
endfunction
//===================================================================================================
// Set player colors and names, or get them
// Courtesy of Acehart
globals
string array PlayerColors
string array PlayerNames
endglobals
function Colors_and_Names takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
if ( GetPlayerColor(Player(i)) == PLAYER_COLOR_RED ) then
set PlayerColors[i] = "|c00ff0303"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_BLUE ) then
set PlayerColors[i] = "|c000042ff"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_CYAN ) then
set PlayerColors[i] = "|c001ce6b9"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_PURPLE ) then
set PlayerColors[i] = "|c00540081"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_YELLOW ) then
set PlayerColors[i] = "|c00fffc01"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_ORANGE ) then
set PlayerColors[i] = "|c00ff8000"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_GREEN ) then
set PlayerColors[i] = "|c0020c000"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_PINK ) then
set PlayerColors[i] = "|c00e55bb0"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_LIGHT_GRAY ) then
set PlayerColors[i] = "|c00959697"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_LIGHT_BLUE ) then
set PlayerColors[i] = "|c007ebff1"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_AQUA ) then
set PlayerColors[i] = "|c00106246"
elseif ( GetPlayerColor(Player(i)) == PLAYER_COLOR_BROWN ) then
set PlayerColors[i] = "|c004e2a04"
else
set PlayerColors[i] = "|c00000000"
endif
set PlayerNames[i] = PlayerColors[i] + GetPlayerName(Player(i)) + "|r"
set i = i + 1
endloop
endfunction
//===================================================================================================
// Creates an error message when bad stuff happens
// Courtesy of Vexorian
function SimError takes player ForPlayer, string msg returns nothing
local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call StartSound( error )
endif
call KillSoundWhenDone( error)
set error=null
endfunction
//==================================================================================================
//Checks if single player mode
function SinglePlayer_Bool takes nothing returns boolean
return GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(GetFilterPlayer())==MAP_CONTROL_USER
endfunction
function SinglePlayer takes nothing returns boolean
local force f = CreateForce()
local boolexpr b = Condition(function SinglePlayer_Bool)
call ForceEnumPlayers(f,b)
set bj_forceCountPlayers = 0
call ForForce(f, function CountPlayersInForceEnum)
call DestroyForce(f)
set f = null
if bj_forceCountPlayers>1 then
return false
endif
return true
endfunction
//==================================================================================================
//Count the number of players in a given force
function ForceCountPlayers takes nothing returns nothing
if GetPlayerSlotState(GetEnumPlayer())==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(GetEnumPlayer())==MAP_CONTROL_USER then
set bj_forceCountPlayers=bj_forceCountPlayers+1
endif
endfunction
function ForcePlayers takes force f returns integer
set bj_forceCountPlayers=0
call ForForce(f,function ForceCountPlayers)
return bj_forceCountPlayers
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library GameCache initializer InitCache
globals
gamecache cscache = null
private integer array cs_array
endglobals
//=================================================================================================
//** Return bug
// Simply classic
function H2I takes handle h returns integer
return h
return 0
endfunction
//=================================================================================================
//** For storage of structs onto handles
function SetData takes handle h, integer v returns nothing
local integer i=H2I(h)-0x100000
if (i>=8191) then
call StoreInteger(cscache,"csdata",I2S(i),v)
else
set cs_array[i]=v
endif
endfunction
function GetData takes handle h returns integer
local integer i=H2I(h)-0x100000
if (i>=8191) then
return GetStoredInteger(cscache,"csdata",I2S(i))
endif
return cs_array[i]
endfunction
//=================================================================================================
//** Initialize my gamecache, wrapper to retrieve it
function InitCache takes nothing returns nothing
call FlushGameCache(InitGameCache("emjlr3's cache"))
set cscache = InitGameCache("emjlr3's cache")
endfunction
function CSCache takes nothing returns gamecache
return cscache
endfunction
//=============================================================================================
//** Use the return bug to convert a handle into a string
// Could I be anymore lazy?
function GetAttTable takes handle h returns string
return I2S(H2I(h))
endfunction
// Looks like I can
function GAT takes handle h returns string
return I2S(H2I(h))
endfunction
//============================================================================================================
//** Wrapper for removing stored data from a string
function ClearTable takes string table returns nothing
call FlushStoredMission(cscache,table)
endfunction
// Yup....
function CT takes string table returns nothing
call FlushStoredMission(cscache,table)
endfunction
//** The following are simply wrapper functions to store/retrieve information with gamecache
//============================================================================================================
function SetInt takes string table, string field, integer val returns nothing
if (val==0) then
call FlushStoredInteger(cscache,table,field)
else
call StoreInteger(cscache,table,field,val)
endif
endfunction
function GetInt takes string table, string field returns integer
return GetStoredInteger(cscache,table,field)
endfunction
//============================================================================================================
function SetReal takes string table, string field, real val returns nothing
if (val==0) then
call FlushStoredReal(cscache,table,field)
else
call StoreReal(cscache,table,field,val)
endif
endfunction
function GetReal takes string table, string field returns real
return GetStoredReal(cscache,table,field)
endfunction
//============================================================================================================
function SetBool takes string table, string field, boolean val returns nothing
if (not(val)) then
call FlushStoredBoolean(cscache,table,field)
else
call StoreBoolean(cscache,table,field,val)
endif
endfunction
function GetBool takes string table, string field returns boolean
return GetStoredBoolean(cscache,table,field)
endfunction
//============================================================================================================
function SetString takes string table, string field, string val returns nothing
if (val=="") or (val==null) then
call FlushStoredString(cscache,table,field)
else
call StoreString(cscache,table,field,val)
endif
endfunction
function GetString takes string table, string field returns string
return GetStoredString(cscache,table,field)
endfunction
//============================================================================================================
function SetObject takes string table, string field, handle val returns nothing
local gamecache g = cscache
if (val==null) then
call FlushStoredInteger(g,table,field)
else
call StoreInteger(g,table,field,H2I(val))
endif
endfunction
function GetUnit takes string table, string field returns unit
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetItem takes string table, string field returns item
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetEffect takes string table, string field returns effect
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetTrigger takes string table, string field returns trigger
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetTimer takes string table, string field returns timer
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetGroup takes string table, string field returns group
return GetStoredInteger(cscache,table,field)
return null
endfunction
function GetLoc takes string table, string field returns location
return GetStoredInteger(cscache,table,field)
return null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TimerSafety
//==========================================================================================
globals
private timer array Timers
private integer N_Timers = 0
endglobals
//==========================================================================================
// Get yourself a timer for use
function NewTimer takes nothing returns timer
if (N_Timers==0) then
return CreateTimer()
endif
set N_Timers=N_Timers-1
return Timers[N_Timers]
endfunction
//==========================================================================================
// Done with your timer? Let's recycle it!
function EndTimer takes timer t returns nothing
call PauseTimer(t)
if (N_Timers>=8191) then
//gg, your map is toast anyways, destroying a timer is the least of your worries
debug call BJDebugMsg("Error, greater then 8191 active timers.")
call DestroyTimer(t)
else
set Timers[N_Timers]=t
set N_Timers=N_Timers+1
endif
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope Bristleback
globals
private integer abil_id = 'A00X' // Bristleback ability rawcode
private integer dum_id = 'A010' // Quillspray ability rawcode
private real stack = 200. // Damage stored before quill spray release
private real back = .1 // Damage negated/lvl from back
private real side = .05 // Damage negated/lvl from sides
endglobals
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
function Conds takes nothing returns boolean
return not IsUnitType(GetEventDamageSource(),UNIT_TYPE_STRUCTURE)
endfunction
private function Cast takes unit u returns nothing
local unit dum = CreateUnit(GetOwningPlayer(u),CasterUnitId,GetUnitX(u),GetUnitY(u),0.)
call UnitAddAbility(dum,dum_id)
call SetUnitAbilityLevel(dum,dum_id,GetUnitAbilityLevel(u,abil_id))
call IssueImmediateOrderById(dum,852526)
call UnitApplyTimedLife(dum,'BTLF',1.)
set dum = null
endfunction
private function Stack takes unit u, real dam returns nothing
local string s = GAT(u)
local real r = GetReal(s,"BB_Stack")
if r+dam>stack then
call SetReal(s,"BB_Stack",0.)
call Cast(u)
else
call SetReal(s,"BB_Stack",r+dam)
endif
endfunction
private function Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetEventDamageSource()
local real ang = ABU(targ,u)
local real face = GetUnitFacing(u)
local real r
local real dam = GetEventDamage()
local real restore
if(dam>1)and GetUnitState(u,UNIT_STATE_LIFE)>.405 then
if((face-ang)<(-180.))then
set r = face-ang+360.
else
if((face-ang)>180.)then
set r = face-ang-360.
else
set r = face-ang
endif
endif
set r = RAbsBJ(r)
if r<=70. then
set restore = GetUnitAbilityLevel(u,abil_id)*back*dam
call Stack(u,dam-restore)
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+restore)
elseif r<='s' then
set restore = GetUnitAbilityLevel(u,abil_id)*side*dam
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+restore)
endif
endif
set u = null
set targ = null
endfunction
private function Actions takes nothing returns nothing
local trigger t
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set t = CreateTrigger()
call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function Acts)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum_id)
endfunction
endscope
//TESH.scrollpos=31
//TESH.alwaysfold=0
scope QuillSpray
globals
private integer abil_id = 'A010' // Quill Spray ability rawcode
private real range = 650. // Range for damage
private real base = 20. // Base damage/lvl
private real stack = 30. // Stack damage/lvl
private real length = 10. // Time for bonus stacking
private real stacks = 4 // Number of times it stacks
private unit U = null
private real R = 0.
private string S = ""
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction
private function Dam takes nothing returns nothing
local string s = GAT(GetEnumUnit())+S
local integer i = GetInt(s,"Quill")
call UnitDamageTarget(U,GetEnumUnit(),(i*stack)+base,false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
if i<stacks then
set i = i + 1
endif
call SetInt(s,"Quill",i)
endfunction
private function Drop takes nothing returns nothing
local string s = GAT(GetEnumUnit())+S
local integer i = GetInt(s,"Quill")
if i==1 then
call CT(s)
else
call SetInt(s,"Quill",i-1)
endif
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local string s
local group g = CreateGroup()
if IsUnitType(u,UNIT_TYPE_HERO)==false then
set u = GetTriggerUnit()
endif
set s = GAT(u)
call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),range,Condition(function Filt))
set U = u
set R = GetUnitAbilityLevel(u,abil_id)*base
set S = s
call ForGroup(g,function Dam)
call PolledWait2(length)
set S = s
call ForGroup(g,function Drop)
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope ViscousNasalGoo
globals
private integer abil_id = 'A00Y' // Viscous Nasal Goo ability rawcode
private integer buff_id = 'B008' // Viscous Nasal Goo buff rawcode
private integer dum_id = 'A00Z' // Snot ability rawcode
private integer stacks = 4 // Max number of stacks
endglobals
private function Start takes integer lvl returns integer
return (lvl*4)-3 // Start level for dummy ability
endfunction
private function Stack takes integer lvl, unit targ, integer count returns integer
return (lvl*4)-3+count // Stacking equation for dummy ability
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetSpellTargetUnit()
local string s = GAT(targ)+"Goo"
local integer count = GetInt(s,"count")
local unit dum = CreateUnit(GetOwningPlayer(u),CasterUnitId,GetUnitX(u),GetUnitY(u),0.)
call UnitAddAbility(dum,dum_id)
if GetUnitAbilityLevel(targ,buff_id)>0 then
call SetUnitAbilityLevel(dum,dum_id,Stack(GetUnitAbilityLevel(u,abil_id),targ,count))
if count<stacks then
call SetInt(s,"count",count+1)
endif
else
call SetUnitAbilityLevel(dum,dum_id,Start(GetUnitAbilityLevel(u,abil_id)))
call SetInt(s,"count",1)
endif
call IssueTargetOrderById(dum,852662,targ)
call UnitApplyTimedLife(dum,'BTLF',1.)
set targ = null
set dum = null
endfunction
private function Death takes nothing returns nothing
call CT(GAT(GetTriggerUnit())+"Goo")
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum_id)
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( trig, function Death )
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope Warpath
globals
private integer abil_id = 'A011' // Warpath ability rawcode
private integer dum_id = 'A012' // Warpath(dummy) ability rawcode
private integer buff_id = 'B009' // Warpath buff rawcode
private integer abil2_id = 'A00Y' // Viscous Nasal Goo ability rawcode
private integer abil3_id = 'A010' // Quill Spray ability rawcode
private integer stacks = 4 // Total numebr of stacks
endglobals
private function Start takes integer lvl returns integer
if lvl==1 then // Start level for dummy ability
return 1
elseif lvl==2 then
return 5
else
return 10
endif
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil2_id or GetSpellAbilityId()==abil3_id and GetUnitAbilityLevel(GetTriggerUnit(),abil_id)>0
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local string s = GAT(u)
local integer lvl = GetUnitAbilityLevel(u,abil_id)
local integer i = GetInt(s,"WP")+1
local unit dum = CreateUnit(GetOwningPlayer(u),CasterUnitId,GetUnitX(u),GetUnitY(u),0.)
call UnitAddAbility(dum,dum_id)
if GetUnitAbilityLevel(u,buff_id)==0 then
set i = 0
elseif i>stacks then
set i = stacks
endif
call SetUnitAbilityLevel(dum,dum_id,Start(lvl)+i)
call IssueTargetOrder(dum,"bloodlust",u)
call UnitApplyTimedLife(dum,'BTLF',1.)
call SetInt(s,"WP",i)
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum_id)
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope Aftershock
globals
private integer abil_id = 'A009' // Aftershock ability rawcode
private integer abil1_id = 'A008' // Fissure ability rawcode
private integer abil2_id = 'A005' // Echo Slam ability rawcode
private integer abil3_id = 'A006' // Enchant Totem ability rawcode
private integer dummy_id = 'A004' // Aftershock Effect ability rawcode
endglobals
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)>0 then
return GetSpellAbilityId()==abil1_id or GetSpellAbilityId()==abil2_id or GetSpellAbilityId()==abil3_id
endif
return false
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit dum = CreateUnit(GetOwningPlayer(u),CasterUnitId,GetUnitX(u),GetUnitY(u),0.)
call UnitAddAbility(dum,dummy_id)
call SetUnitAbilityLevel(dum,dummy_id,GetUnitAbilityLevel(u,abil_id))
call IssueImmediateOrder(dum,"stomp")
call UnitApplyTimedLife(dum,'BTLF',2.)
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EchoSlam
globals
private integer abil_id = 'A005' // Echo Slam ability rawcode
private integer dummy_id = 'A003' // Echo Slam reverberate ability rawcode
private real area = 500. // Area of effect
private unit U
private group G = CreateGroup()
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
private function Effects takes nothing returns nothing
local unit dum = CreateUnit(GetOwningPlayer(U),CasterUnitId,GetUnitX(GetEnumUnit()),GetUnitY(GetEnumUnit()),0.)
call SetUnitScale(dum,.25,.25,.25)
call UnitAddAbility(dum,dummy_id)
call SetUnitAbilityLevel(dum,dummy_id,GetUnitAbilityLevel(U,abil_id))
call IssueImmediateOrder(dum,"fanofknives")
call UnitApplyTimedLife(dum,'BTLF',2.)
set dum = null
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call PolledWait2(.3)
call GroupClear(G)
call GroupEnumUnitsInRange(G,GetUnitX(u),GetUnitY(u),area,Condition(function Filt))
set U = u
call ForGroup(G,function Effects)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnchantTotem
globals
private integer buff_id = 'B000' // Enchant Totem buff rawcode
private real time = .5 // Time to wait after attack initiates to remove buff
endglobals
private struct data
unit u
timer t
endstruct
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(),buff_id)>0
endfunction
private function Remove takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call UnitRemoveAbility(d.u,buff_id)
call EndTimer(d.t)
call d.destroy()
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetAttacker()
set d.t = NewTimer()
call SetData(d.t,d)
call TimerStart(d.t,time,false,function Remove)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope Fissure
globals
private integer abil_id = 'A008' // Fissure ability rawcode
private integer dummy_id = 'B000' // Fissure Doodad rawcode
private real distance = 60. // Distance between each doodad
private real max_dist = 1200. // Total distance
private real duration = 8. // Duration of doodads
private string sfx = "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl" // Created effect at each doodad
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local destructable array d
local location l = GetSpellTargetLoc()
local real xu = GetUnitX(u)
local real yu = GetUnitY(u)
local real xl = GetLocationX(l)
local real yl = GetLocationY(l)
local real ang = ABPXY(xu,yu,xl,yl)
local real dist = distance
local integer i = 1
loop
exitwhen dist>max_dist
set d[i] = CreateDestructable(dummy_id,SafeX(xu+dist*Cos(ang*bj_DEGTORAD)),SafeY(yu+dist*Sin(ang*bj_DEGTORAD)),GetRandomReal(0,360),.5,GetRandomInt(0,2))
call DestroyEffect(AddSpecialEffect(sfx,xu+dist*Cos(ang*bj_DEGTORAD),yu+dist*Sin(ang*bj_DEGTORAD)))
set dist = dist+ distance
set i = i + 1
endloop
call PolledWait2(duration)
loop
exitwhen i==0
call RemoveDestructable(d[i])
set d[i] = null
set i = i - 1
endloop
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HealingWard
globals
private integer abil_id = 'A00B' // Healing Ward ability rawcode
private integer dum_id = 'A00E' // Healing Ward Aura ability rawcode
private integer dummy_id = 'o001' // Healing Ward unit rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetUnitTypeId(GetSummonedUnit())==dummy_id
endfunction
private function Actions takes nothing returns nothing
call SetUnitAbilityLevel(GetSummonedUnit(),dum_id,GetUnitAbilityLevel(GetSummoningUnit(),abil_id))
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SUMMON)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=62
//TESH.alwaysfold=0
scope Omnislash
globals
private integer abil_id = 'A00A' // Omnislash ability rawcode
private integer abil2_id = 'A00D' // Blade Fury ability rawcode
private real area = 575. // Area to get new targets
private real interval = .4 // Wait in between slashes
private string sfx = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" // Effect created when blinking
private string sfx2 = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" // Effect attached to sword
private player P = null
private group G = CreateGroup()
endglobals
private function Damage takes nothing returns real
return GetRandomReal(150.,250.) // Damage done to targets
endfunction
private function Hits takes integer lvl returns integer
if lvl==1 then // Number of strikes given the level of the ability
return 3
elseif lvl==2 then
return 5
endif
return 8
endfunction
private struct data
unit u
unit targ
player p
integer lvl
integer other_lvl
integer count = 0
integer total
timer t
effect e
method onDestroy takes nothing returns nothing
call EndTimer(.t)
if .e!=null then
call DestroyEffect(.e)
endif
call SetUnitPathing(.u,true)
call SetUnitInvulnerable(.u,false)
call SetUnitVertexColor(.u,255,255,255,255)
if GetLocalPlayer()==.p then
call SelectUnit(.u,true)
endif
if (.other_lvl>0) then
call UnitAddAbility(.u,abil2_id)
call SetUnitAbilityLevel(.u,abil2_id,.other_lvl)
call TriggerSleepAction(0.)
call SetPlayerAbilityAvailable(.p,abil2_id,true)
endif
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Do_Damage takes unit u, unit targ returns nothing
local real ang = GetRandomReal(0.,360.)*bj_DEGTORAD
call SetUnitX(u,GetUnitX(targ)+50.*Cos(ang))
call SetUnitY(u,GetUnitY(targ)+50.*Sin(ang))
call SetUnitFacing(u,ABU(u,targ))
call SetUnitAnimation(u,"Attack")
call UnitDamageTarget(u,targ,Damage(),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
call DestroyEffect(AddSpecialEffectTarget(sfx,u,"chest"))
endfunction
private function Filt takes nothing returns boolean
return IsUnitVisible(GetFilterUnit(),P) and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) and IsUnitEnemy(GetFilterUnit(),P)
endfunction
private function Get_Target takes unit targ returns unit
call GroupClear(G)
call GroupEnumUnitsInRange(G,GetUnitX(targ),GetUnitY(targ),area,Condition(function Filt))
return GroupPickRandomUnit(G)
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
set d.count = d.count + 1
if d.count>=d.total then
call d.destroy()
return
endif
set P = d.p
set d.targ = Get_Target(d.targ)
if d.targ!=null then
call Do_Damage(d.u,d.targ)
else
call d.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.p = GetOwningPlayer(d.u)
set d.targ = GetSpellTargetUnit()
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.other_lvl = GetUnitAbilityLevel(d.u,abil2_id)
set d.total = Hits(d.lvl)
set d.t = NewTimer()
call SetData(d.t,d)
if (d.other_lvl>0) then
call SetPlayerAbilityAvailable(d.p,abil2_id,false)
endif
if GetLocalPlayer()==d.p then
call SelectUnit(d.u,false)
endif
call SetUnitVertexColor(d.u,255,255,255,125)
call SetUnitPathing(d.u,false)
call SetUnitInvulnerable(d.u,true)
call TriggerSleepAction(0.)
if GetWidgetLife(d.targ)>.405 then
set d.e = AddSpecialEffectTarget(sfx2,d.u,"weapon")
call TimerStart(d.t,interval,true,function Effects)
call Do_Damage(d.u,d.targ)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=72
//TESH.alwaysfold=0
scope Eclipse
globals
private integer abil_id = 'A026' // Eclipse ability rawcode
private integer abil2_id = 'A024' // Lucent Beam ability rawcode
private integer dummy_id = 'A027' // Eclipse (Dummy) ability rawcode
private real interval = .55 // Speed of timer for hits
private real area = 700. // Area to grab targets
private integer max = 4 // Max hits for a single target per instance
private group G = CreateGroup()
private player P = null
private unit U = null
private string S = ""
endglobals
private function Hits takes integer lvl returns integer
return 1+(lvl*3) //Number of hits/lvl
endfunction
private struct data
unit u
unit dum
timer t
integer lvl
integer count = 0
player p
group grp
string su
static method Remove takes nothing returns nothing
call ClearTable(I2S(H2I(U))+"Eclipse"+S)
endmethod
method onDestroy takes nothing returns nothing
call UnitApplyTimedLife(.dum,'BTLF',.5)
call EndTimer(.t)
set S = .su
call ForGroup(.grp,function data.Remove)
call DestroyGroup(.grp)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
local string s
set U = GetFilterUnit()
set s = I2S(H2I(U))+"Eclipse"+S
if GetInt(s,"Count")>=4 then
return false
endif
return IsUnitVisible(U,P) and IsUnitEnemy(U,P) and GetWidgetLife(U)>.405 and not IsUnitType(U,UNIT_TYPE_STRUCTURE)
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local string s
set d.count = d.count + 1
if d.count>Hits(d.lvl) then
call d.destroy()
return
endif
set P = d.p
set S = d.su
call GroupClear(G)
call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),area,Condition(function Filt))
set U = GroupPickRandomUnit(G)
if U!=null then
call GroupAddUnit(d.grp,U)
call IssueTargetOrderById(d.dum,OrderId("firebolt"),U)
set s = I2S(H2I(U))+"Eclipse"+d.su
call SetInt(s,"Count",GetInt(s,"Count")+1)
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.p = GetOwningPlayer(d.u)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.dum = CreateUnit(d.p,CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
call UnitAddAbility(d.dum,dummy_id)
call SetUnitAbilityLevel(d.dum,dummy_id,GetUnitAbilityLevel(d.u,abil2_id))
set d.grp = CreateGroup()
set d.su = I2S(H2I(d.u))
set d.t = NewTimer()
call TimerStart(d.t,interval,true,function Effects)
call SetData(d.t,d)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MoonGlaive
globals
private integer abil_id = 'A025' // Moon Glaive ability rawcode
private integer upg_id = 'R004' // Upgrade Moon Glaive upgrade rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Actions takes nothing returns nothing
call SetPlayerTechResearched(GetOwningPlayer(GetTriggerUnit()),upg_id,GetUnitAbilityLevel(GetTriggerUnit(),abil_id))
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope AdaptiveStrike
globals
private integer abil_id = 'A02K' // Adaptive Strike ability rawcode
private real knock = 200. // Knockback distance for strength strike
endglobals
private function DamageAgi takes integer lvl, integer agility returns real
return (lvl*.4+1.)*agility+(30.*lvl) // Damage/lvl for agility
endfunction
private function Stun takes integer lvl returns real
return 1.+(.4*lvl) // Stun/lvl for strength
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(u,abil_id)
local real ang
if GetHeroAgi(u,true)>=GetHeroStr(u,true)then
call UnitDamageTarget(u,targ,DamageAgi(lvl,GetHeroAgi(u,true)),true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
else
set ang = ABU(u,targ)*bj_DEGTORAD
call SetUnitX(targ,SafeX(GetUnitX(targ)+knock*Cos(ang)))
call SetUnitY(targ,SafeY(GetUnitY(targ)+knock*Sin(ang)))
call KillTrees(GetUnitX(targ),GetUnitY(targ),200.)
call PauseUnit(targ,true)
call PolledWait2(Stun(lvl))
call PauseUnit(targ,false)
endif
set targ = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Morph
globals
private integer abil_id = 'A02L' // Morph ability rawcode
private integer abil2_id = 'A02M' // Morph (Extra) ability rawcode
private integer mana = 20 // Mana cost per morph
private integer stat = 2 // Stat morph/lvl
endglobals
private struct data
unit u
trigger add_str
trigger add_agi
trigger off
trigger on
endstruct
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
function Add_Str takes nothing returns nothing
local data d = GetData(GetTriggeringTrigger())
local integer lvl = GetUnitAbilityLevel(d.u,abil_id)
if GetHeroAgi(d.u,false)>stat*lvl and GetUnitState(d.u,UNIT_STATE_MANA)>=mana then
call SetUnitState(d.u,UNIT_STATE_MANA,GetUnitState(d.u,UNIT_STATE_MANA)-mana)
call SetHeroAgi(d.u,GetHeroAgi(d.u,false)-stat*lvl,true)
call SetHeroStr(d.u,GetHeroStr(d.u,false)+stat*lvl,true)
endif
endfunction
function Add_Agi takes nothing returns nothing
local data d = GetData(GetTriggeringTrigger())
local integer lvl = GetUnitAbilityLevel(d.u,abil_id)
if GetHeroStr(d.u,false)>stat*lvl and GetUnitState(d.u,UNIT_STATE_MANA)>=mana then
call SetUnitState(d.u,UNIT_STATE_MANA,GetUnitState(d.u,UNIT_STATE_MANA)-mana)
call SetHeroAgi(d.u,GetHeroAgi(d.u,false)+stat*lvl,true)
call SetHeroStr(d.u,GetHeroStr(d.u,false)-stat*lvl,true)
endif
endfunction
function Cond_Off takes nothing returns boolean
if GetIssuedOrderId()==OrderId("replenishmanaoff") or GetIssuedOrderId()==852547 then
return true
endif
return false
endfunction
function Off takes nothing returns nothing
local data d = GetData(GetTriggeringTrigger())
if(GetIssuedOrderId()==OrderId("replenishlifeoff"))then
call DisableTrigger(d.add_str)
endif
if(GetIssuedOrderId()==OrderId("replenishmanaoff"))then
call DisableTrigger(d.add_agi)
endif
endfunction
function Cond_On takes nothing returns boolean
if GetIssuedOrderId()==OrderId("replenishmanaon") or GetIssuedOrderId()==852546 then
return true
endif
return false
endfunction
function On takes nothing returns nothing
local data d = GetData(GetTriggeringTrigger())
if(GetIssuedOrderId()==OrderId("replenishlifeon"))then
call EnableTrigger(d.add_str)
call DisableTrigger(d.add_agi)
endif
if(GetIssuedOrderId()==OrderId("replenishmanaon"))then
call DisableTrigger(d.add_str)
call EnableTrigger(d.add_agi)
endif
endfunction
private function Actions takes nothing returns nothing
local data d
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set d = data.create()
set d.u = GetTriggerUnit()
call UnitAddAbility(d.u,abil2_id)
set d.add_str = CreateTrigger()
call DisableTrigger(d.add_str)
call TriggerRegisterTimerEvent(d.add_str, 1., true)
call TriggerAddAction(d.add_str,function Add_Str)
call SetData(d.add_str,d)
set d.add_agi = CreateTrigger()
call DisableTrigger(d.add_agi)
call TriggerRegisterTimerEvent(d.add_agi, 1., true)
call TriggerAddAction(d.add_agi,function Add_Agi)
call SetData(d.add_agi,d)
set d.off = CreateTrigger()
call TriggerRegisterUnitEvent(d.off,d.u,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(d.off,Condition(function Cond_Off))
call TriggerAddAction(d.off,function Off)
call SetData(d.off,d)
set d.on = CreateTrigger()
call TriggerRegisterUnitEvent(d.on,d.u,EVENT_UNIT_ISSUED_ORDER)
call TriggerAddCondition(d.on,Condition(function Cond_On))
call TriggerAddAction(d.on,function On)
call SetData(d.on,d)
else
call SetUnitAbilityLevel(GetTriggerUnit(),abil2_id,GetUnitAbilityLevel(GetTriggerUnit(),abil_id))
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope MorphColorChange
globals
private integer unit_id = 'O005' // Morphling unit rawcode
private real time = 2. // Time between color changes
private group G = CreateGroup()
endglobals
private struct data
unit u
timer t
endstruct
private function Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())==unit_id and not IsUnitInGroup(GetTriggerUnit(),G)
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
if GetWidgetLife(d.u)>.405 then
call SetUnitVertexColor(d.u,GetRandomInt(0,255),GetRandomInt(0,255),GetRandomInt(0,255),GetRandomInt(200,255))
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.t = CreateTimer()
call SetData(d.t,d)
call TimerStart(d.t,time,true,function Effects)
call GroupAddUnit(G,d.u)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterEnterRectSimple(trig,bj_mapInitialPlayableArea)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope Replicate
globals
private integer abil_id = 'A02N' // Replicate ability rawcode
private integer abil2_id = 'A02O' // Morph Replicate ability rawcode
private integer buff_id = 'B00T' // Replicate buff rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local string s = I2S(H2I(GetTriggerUnit()))
call SetObject(s+"Replicate","Target",GetSpellTargetUnit())
endfunction
private function Conditions2 takes nothing returns boolean
return GetSpellAbilityId()==abil2_id
endfunction
private function Actions2 takes nothing returns nothing
local unit u = GetTriggerUnit()
local string s = I2S(H2I(GetTriggerUnit()))+"Replicate"
local unit targ = GetUnit(s,"Target")
local real x = GetUnitX(targ)
local real y = GetUnitY(targ)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",GetUnitX(u),GetUnitY(u)))
call KillUnit(targ)
call SetUnitX(u,x)
call SetUnitY(u,y)
if GetLocalPlayer()==GetOwningPlayer(u) then
call PanCameraTo(x,y)
endif
call IssueImmediateOrderById(u,OrderId("stop"))
set targ = null
endfunction
private function Conditions3 takes nothing returns boolean
return GetUnitAbilityLevel(GetSummonedUnit(),buff_id)>0
endfunction
private function Death takes nothing returns boolean
local trigger t = GetTriggeringTrigger()
local string st = I2S(H2I(t))
local unit u = GetUnit(st,"Hero")
local string s = I2S(H2I(u))+"Replicate"
local unit sum = GetUnit(s,"Target")
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",GetUnitX(sum),GetUnitY(sum)))
call ShowUnit(sum,false)
call UnitRemoveAbility(u,abil2_id)
call SetPlayerAbilityAvailable(GetOwningPlayer(u),abil_id,true)
call CT(st)
call DestroyTrigger(t)
call CT(s)
set t = null
set sum = null
return false
endfunction
private function Actions3 takes nothing returns nothing
local unit u = GetSummoningUnit()
local string s = I2S(H2I(u))+"Replicate"
local unit targ = GetUnit(s,"Target")
local unit sum = GetSummonedUnit()
local trigger t = CreateTrigger()
call SetPlayerAbilityAvailable(GetOwningPlayer(u),abil_id,false)
call UnitAddAbility(u,abil2_id)
call SetUnitColor(sum,GetPlayerColor(GetOwningPlayer(targ)))
call SetObject(s,"Target",sum)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DEATH)
call TriggerRegisterUnitEvent(t,sum,EVENT_UNIT_DEATH)
call TriggerAddCondition(t,Condition(function Death))
call SetObject(I2S(H2I(t)),"Hero",u)
set targ = null
set sum = null
set t = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions2 )
call TriggerAddCondition(trig,Condition(function Conditions2))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SUMMON)
call TriggerAddAction( trig, function Actions3 )
call TriggerAddCondition(trig,Condition(function Conditions3))
call PreLoadAbil(abil2_id)
endfunction
endscope
//TESH.scrollpos=45
//TESH.alwaysfold=0
scope Waveform
globals
private integer abil_id = 'A02J' // Waveform ability rawcode
private string sfx = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" // Effect created while moving
private real distance = 50. // Distance moved per interval
endglobals
private function Damage takes integer lvl returns real
return 25.+(75.*lvl) // Damage/lvl
endfunction
private struct data
unit u
unit dum
real ang
real cos
real sin
real dist
integer lvl
real moved = 0.
timer t
trigger trig
method onDestroy takes nothing returns nothing
call PauseUnit(.u,false)
call SetUnitPosition(.u,GetUnitX(.dum),GetUnitY(.dum))
call UnitApplyTimedLife(.dum,'BTLF',.01)
call ShowUnit(.u,true)
if GetLocalPlayer()==GetOwningPlayer(.u) then
call ClearSelection()
call SelectUnit(.u,true)
endif
call EndTimer(.t)
call DestroyTrigger(.trig)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Dam takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
local unit targ = GetTriggerUnit()
if IsUnitEnemy(targ,GetOwningPlayer(d.u)) and GetWidgetLife(targ)>.405 and not IsUnitType(targ,UNIT_TYPE_STRUCTURE) then
call UnitDamageTarget(d.dum,targ,Damage(d.lvl),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
endif
set targ = null
return false
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
set d.moved = d.moved + distance
if d.moved>d.dist or GetWidgetLife(d.u)<.405 then
call d.destroy()
return
endif
call SetUnitX(d.dum,SafeX(GetUnitX(d.dum)+distance*d.cos))
call SetUnitY(d.dum,SafeY(GetUnitY(d.dum)+distance*d.sin))
call DestroyEffect(AddSpecialEffect(sfx,GetUnitX(d.dum),GetUnitY(d.dum)))
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local location l
local real x
local real y
local real ang
if GetSpellTargetUnit()==null then
set l = GetSpellTargetLoc()
else
set l = GetUnitLoc(GetSpellTargetUnit())
endif
set x = GetLocationX(l)
set y = GetLocationY(l)
set d.u = GetTriggerUnit()
set d.dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
set ang = ABPXY(GetUnitX(d.u),GetUnitY(d.u),x,y)
set d.cos = Cos(ang*bj_DEGTORAD)
set d.sin = Sin(ang*bj_DEGTORAD)
set d.dist = DBPXY(GetUnitX(d.u),GetUnitY(d.u),x,y)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.t = NewTimer()
call TimerStart(d.t,.04,true,function Effects)
call SetData(d.t,d)
set d.trig = CreateTrigger()
call TriggerRegisterUnitInRange(d.trig,d.dum,225.,null)
call TriggerAddCondition(d.trig,Condition(function Dam))
call SetData(d.trig,d)
call ShowUnit(d.u,false)
call PauseUnit(d.u,true)
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope CurseoftheSilent
globals
private integer abil_id = 'A00H' // Curse of the Silent ability rawcode
private integer dummy_id = 'B005' // Curse of the Silent buff rawcode
endglobals
private function Mana takes integer lvl returns integer
return lvl*5 // Mana burn given the level
endfunction
private struct data
unit targ
timer t
trigger trig
integer lvl
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Stop takes nothing returns nothing
local data d = GetData(GetTriggeringTrigger())
call UnitRemoveAbility(d.targ,dummy_id)
call EndTimer(d.t)
call DestroyTrigger(d.trig)
call d.destroy()
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
if GetUnitAbilityLevel(d.targ,dummy_id)==0 then
call EndTimer(d.t)
call DestroyTrigger(d.trig)
call d.destroy()
else
call SetUnitState(d.targ,UNIT_STATE_MANA,GetUnitState(d.targ,UNIT_STATE_MANA)-Mana(d.lvl))
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.t = NewTimer()
set d.trig = CreateTrigger()
set d.targ = GetSpellTargetUnit()
set d.lvl = GetUnitAbilityLevel(GetTriggerUnit(),abil_id)
call TimerStart(d.t,1.,true,function Effects)
call TriggerRegisterUnitEvent(d.trig,d.targ,EVENT_UNIT_SPELL_EFFECT)
call TriggerAddAction(d.trig,function Stop)
call SetData(d.t,d)
call SetData(d.trig,d)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope GlaivesofWisdom
globals
private integer abil_id = 'A00I' // Glaives of Wisdom ability rawcode
private integer buff_id = 'B004' // Glaives of Wisdom buff rawcode
endglobals
private function Damage takes integer lvl, unit u returns real
return .15*I2R(lvl*GetHeroInt(u,true)) // Bonus damage done
endfunction
private function Steal takes integer lvl returns integer
return 1 // Intel stolen when heroes are killed
endfunction
private struct data
unit u
unit targ
trigger trig
method onDestroy takes nothing returns nothing
call DestroyTrigger(.trig)
endmethod
endstruct
private function Conditions takes nothing returns boolean
if(GetTriggerEventId()==EVENT_PLAYER_UNIT_ATTACKED)then
return GetUnitAbilityLevel(GetAttacker(),abil_id)>0
elseif(GetTriggerEventId()==EVENT_PLAYER_UNIT_SPELL_EFFECT)then
return GetSpellAbilityId()==abil_id
endif
return false
endfunction
private function Effects takes nothing returns boolean
local real r
local data d = GetData(GetTriggeringTrigger())
if GetUnitAbilityLevel(GetTriggerUnit(),buff_id)>0 and d.u==GetEventDamageSource() and GetEventDamage()>.1 then
call DisableTrigger(d.trig)
set r = Damage(GetUnitAbilityLevel(d.u,abil_id),d.u)
call TextTagUnit("+"+I2S(R2I(r)),GetTriggerUnit(),3,216,216,216,.03,1.)
call UnitDamageTarget(d.u,GetTriggerUnit(),r,false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_DIVINE,null)
endif
return false
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.trig = CreateTrigger()
if(GetTriggerEventId()==EVENT_PLAYER_UNIT_SPELL_EFFECT)then
set d.targ = GetSpellTargetUnit()
set d.u = GetTriggerUnit()
else
set d.targ = GetTriggerUnit()
set d.u = GetAttacker()
endif
call TriggerRegisterUnitEvent(d.trig,d.targ,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(d.trig,Condition(function Effects))
call SetData(d.trig,d)
call PolledWait2(2.)
call d.destroy()
endfunction
private function Steal_Intel takes nothing returns nothing
local unit u = GetKillingUnit()
local unit targ = GetTriggerUnit()
local integer i
if GetUnitAbilityLevel(u,abil_id)>0 and IsUnitType(targ,UNIT_TYPE_HERO) then
set i = Steal(GetUnitAbilityLevel(u,abil_id))
call SetHeroInt(targ,GetHeroInt(targ,false)-i,true)
call SetHeroInt(u,GetHeroInt(u,false)+i,true)
call TextTagUnit("+"+I2S(i)+" Int",u,255,0,0,230,.03,3.)
call TextTagUnit("-"+I2S(i)+" Int",targ,255,0,0,230,.03,3.)
endif
set u = null
set targ = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(trig,function Steal_Intel)
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig,Condition(function Conditions))
call TriggerAddAction(trig,function Actions)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope GlobalSilence
globals
private integer abil_id = 'A00G' // Global Silence ability rawcode
private integer dummy_id = 'A00K' // Silence ability rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local location l = GetUnitLoc(GetTriggerUnit())
local unit dum = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()),CasterUnitId,l,0.)
call ShowUnit(dum,false)
call UnitApplyTimedLife(dum,'BTLF',5.)
call UnitAddAbility(dum,dummy_id)
call SetUnitAbilityLevel(dum,dummy_id,GetUnitAbilityLevel(GetTriggerUnit(),abil_id))
call IssuePointOrderByIdLoc(dum,OrderId("silence"),l)
call PolledWait2(6.)
call RemoveLocation(l)
set l = null
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=5
//TESH.alwaysfold=0
scope LastWord
globals
private integer abil_id = 'A00J' // Last Word ability rawcode
private integer dummy_id = 'A00F' // Last Word Effect ability rawcode
private integer buff_id = 'B003' // Last Word buff rawcode
endglobals
private struct data
unit u
endstruct
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id and GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1
endfunction
private function Check takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),buff_id)>0
endfunction
private function Silence takes nothing returns nothing
local unit targ = GetTriggerUnit()
local data d = GetData(GetTriggeringTrigger())
local unit dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(targ),GetUnitY(targ),0)
call UnitApplyTimedLife(dum,'BTLF',1.)
if IsUnitEnemy(targ,GetOwningPlayer(d.u))then
call UnitAddAbility(dum,dummy_id)
call SetUnitAbilityLevel(dum,dummy_id,GetUnitAbilityLevel(d.u,abil_id))
call IssueTargetOrderById(dum,OrderId("soulburn"),targ)
endif
set targ = null
set dum = null
endfunction
private function Actions takes nothing returns nothing
local trigger trig = CreateTrigger()
local data d = data.create()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_FINISH)
call TriggerAddCondition(trig,Condition(function Check))
call TriggerAddAction(trig,function Silence)
set d.u = GetTriggerUnit()
call SetData(trig,d)
set trig = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope Assassinate
globals
private integer dummy_id = 'e001' // Assassinate Buffer unit rawcode
private integer remove_abil = 'B006' // Assassinate buff rawcode
private integer unit_id = 'U005' // Sniper unit rawcode
endglobals
private function GetShots takes integer lvl returns integer
return 4+4*lvl // Number of balls/lvl
endfunction
private function Distance takes nothing returns real
return GetRandomReal(0.,360.) // Min to max distance for area
endfunction
private function Conditions takes nothing returns boolean
return GetIssuedOrderId()==OrderId("thunderbolt") and GetUnitTypeId(GetOrderedUnit())==unit_id
endfunction
private function Actions takes nothing returns nothing
local player p = GetOwningPlayer(GetOrderedUnit())
local unit targ = GetOrderTargetUnit()
local unit dum
call UnitShareVision(targ,p,true)
set dum = CreateUnit(GetOwningPlayer(targ),dummy_id,0.,0.,bj_UNIT_FACING)
call PolledWait2(3.)
call UnitShareVision(targ,p,false)
call RemoveUnit(dum)
call UnitRemoveAbility(targ,remove_abil)
set targ = null
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerAddCondition(trig,Condition(function Conditions))
call TriggerAddAction(trig,function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TakeAim
globals
private integer abil_id = 'A00O' // Take Aim ability rawcode
private integer upg_id = 'R003' // Take Aim upgrade rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Actions takes nothing returns nothing
call SetPlayerTechResearched(GetOwningPlayer(GetTriggerUnit()),upg_id,GetUnitAbilityLevel(GetTriggerUnit(),abil_id))
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope ScatterShot
globals
private integer abil_id = 'A00M' // ScatterShot ability rawcode
private integer dum_id = 'e000' // ScatterShot unit rawcode
private integer dum2_id = 'e006' // ScatterShot (Effect) unit rawcode
endglobals
private function GetShots takes integer lvl returns integer
return 4+4*lvl // Number of shots/lvl
endfunction
private function Distance takes nothing returns real
return GetRandomReal(0.,360.) // Min to max distance for area
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local location l = GetSpellTargetLoc()
local real xl = GetLocationX(l)
local real yl = GetLocationY(l)
local real dist
local real ang
local location m
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local integer i = GetShots(GetUnitAbilityLevel(u,abil_id))
local player p = GetOwningPlayer(u)
local unit dum
loop
exitwhen i<=0
set dum = CreateUnit(p,dum_id,x,y,0.)
set dist = Distance()
set ang = GetRandomReal(0.,360.)*bj_DEGTORAD
set m = Location(xl+dist*Cos(ang),yl+dist*Sin(ang))
call IssuePointOrderLoc(dum,"attackground",m)
call UnitApplyTimedLife(dum,'BTLF',.5)
call RemoveLocation(m)
set i = i-1
endloop
set dum = CreateUnit(p,dum2_id,GetUnitX(u),GetUnitY(u),0.)
call SetUnitTimeScale(dum,1.75)
call PolledWait2(.9)
call RemoveUnit(dum)
call RemoveLocation(l)
set l = null
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope Backstab
globals
private integer abil_id = 'A00S' // Backstab ability rawcode
private string sfx = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" // Effected created on target
endglobals
private function Damage takes integer lvl returns real
return (.25*lvl)*GetHeroAgi(GetAttacker(),true) // Damage done
endfunction
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetAttacker(),abil_id)>0 and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetAttacker())) and not IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE) then
return RAbsBJ((GetUnitFacing(GetTriggerUnit())-GetUnitFacing(GetAttacker())))<=105.
else
return false
endif
endfunction
private function Actions takes nothing returns nothing
call DestroyEffect(AddSpecialEffectTarget(sfx,GetTriggerUnit(),"chest"))
call UnitDamageTarget(GetAttacker(),GetTriggerUnit(),Damage(GetUnitAbilityLevel(GetAttacker(),abil_id)),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=7
//TESH.alwaysfold=0
scope BlinkStrike
globals
private integer abil_id = 'A00U' // Blink Strike ability rawcode
endglobals
private function Damage takes integer lvl returns real
return 30.*lvl // Damage/lvl
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetSpellTargetUnit()
local real r = Damage(GetUnitAbilityLevel(u,abil_id))
call SetUnitX(u,GetUnitX(targ))
call SetUnitY(u,GetUnitY(targ))
if IsUnitEnemy(targ,GetOwningPlayer(u))then
call UnitDamageTarget(u,targ,r,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
call IssueTargetOrderById(u,OrderId("attack"),targ)
endif
set u = null
set targ = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PermanentInvisibility
globals
private integer abil_id = 'A00V' // Permanent Invisibility (Main) ability rawcode
private integer upg_id = 'A00W' // Permanent Invisibility ability rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Actions takes nothing returns nothing
if(GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1)then
call UnitAddAbility(GetTriggerUnit(),upg_id)
endif
call SetUnitAbilityLevel(GetTriggerUnit(),upg_id,GetUnitAbilityLevel(GetTriggerUnit(),abil_id))
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(upg_id)
endfunction
endscope
//TESH.scrollpos=5
//TESH.alwaysfold=0
scope SmokeScreen
globals
private integer unit_id = 'e002' // Smoke Screen unit rawcode
private integer abil_id = 'A00T' // Smoke Screen ability rawcode
private integer abil2_id = 'A00Q' // Smoke screen sentinel ability rawcode
private integer abil3_id = 'A00R' // Smoke screen scourge ability rawcode
endglobals
private function Size takes integer lvl returns real
return (83+(17*lvl))*.01 // Size of cloud
endfunction
private function Conditions takes nothing returns boolean
return GetUnitTypeId(GetSummonedUnit())==unit_id
endfunction
private function Actions takes nothing returns nothing
local unit smoke = GetSummonedUnit()
local player p = GetOwningPlayer(smoke)
local integer lvl = GetUnitAbilityLevel(GetSummoningUnit(),abil_id)
local real r = Size(lvl)
call SetUnitScale(smoke,r,r,r)
if IsPlayerAlly(p,Player(0)) then
call UnitAddAbility(smoke,abil2_id)
call SetUnitAbilityLevel(smoke,abil2_id,lvl)
else
call UnitAddAbility(smoke,abil3_id)
call SetUnitAbilityLevel(smoke,abil3_id,lvl)
endif
call IssuePointOrderById(smoke,OrderId("cloudoffog"),GetUnitX(smoke),GetUnitY(smoke))
set smoke = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SUMMON)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(abil2_id)
call PreLoadAbil(abil3_id)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BattleHunger
globals
private integer buff_id = 'B00H' // Battle Hunger buff rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetKillingUnit(),buff_id)>0
endfunction
private function Actions takes nothing returns nothing
call UnitRemoveAbility(GetKillingUnit(),'B00H')
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=53
//TESH.alwaysfold=0
scope BerserkerCall
globals
private integer abil_id = 'A01M' // Berserker's Call ability rawcode
private integer abil2_id = 'A01N' // Berserker's Call effect ability rawcode
private integer buff_id = 'B00F' // Bersker's Call(Targets) buff rawcode
private real area = 550. // Area for effect
private unit U = null
endglobals
private function Length takes integer lvl returns real
return 1+.5*lvl // Duration of effects
endfunction
private struct data
unit u
group grp
trigger trig
method onDestroy takes nothing returns nothing
call DestroyGroup(.grp)
call DestroyTrigger(.trig)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(),buff_id)>0 and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(U))
endfunction
private function Effect takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
if IsUnitInGroup(GetTriggerUnit(),d.grp) and GetWidgetLife(d.u)>.405 then
call DisableTrigger(d.trig)
call IssueTargetOrder(GetTriggerUnit(),"attack",d.u)
call EnableTrigger(d.trig)
endif
return false
endfunction
private function Attack takes nothing returns nothing
call IssueTargetOrder(GetEnumUnit(),"attack",U)
endfunction
//This is a generic creep wave restart for this map, it would need to be changed in yours
private function Actions takes nothing returns nothing
local data d = data.create()
local unit dum
set d.u = GetTriggerUnit()
set d.grp = CreateGroup()
set d.trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(d.trig,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterAnyUnitEventBJ(d.trig,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterAnyUnitEventBJ(d.trig,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddCondition(d.trig,Condition(function Effect))
call SetData(d.trig,d)
call PolledWait2(.2)
set dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
call UnitAddAbility(dum,abil2_id)
call SetUnitAbilityLevel(dum,abil2_id,GetUnitAbilityLevel(d.u,abil_id))
call IssueTargetOrderById(dum,OrderId("innerfire"),d.u)
call UnitApplyTimedLife(dum,'BTLF',1.)
set U = d.u
call GroupEnumUnitsInRange(d.grp,GetUnitX(d.u),GetUnitY(d.u),area,Condition(function Filt))
call ForGroup(d.grp,function Attack)
call PolledWait2(Length(GetUnitAbilityLevel(d.u,abil_id)))
call d.destroy()
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(abil2_id)
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope CounterHelix
globals
private integer abil_id = 'A01P' // Counter Helix ability rawcode
private real chance = .15 // Percent chance to fire
private real area = 300. // Area for effect
private string sfx = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" // Effected created on targets
private group G = CreateGroup()
private group CD = CreateGroup()
private unit U = null
endglobals
private function Damage takes integer lvl returns real
return 75.+(25.*lvl) // Damage done
endfunction
private function Conditions takes nothing returns boolean
return not IsUnitInGroup(GetTriggerUnit(),CD) and GetRandomReal(0.,1.)<chance and not IsUnitType(GetAttacker(),UNIT_TYPE_STRUCTURE) and GetUnitAbilityLevel(GetTriggerUnit(),abil_id)>0
endfunction
private function Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(U)) and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
private function Effects takes nothing returns nothing
call DestroyEffect(AddSpecialEffectTarget(sfx,GetEnumUnit(),"chest"))
call UnitDamageTarget(U,GetEnumUnit(),Damage(GetUnitAbilityLevel(U,abil_id)),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call GroupClear(G)
set U = u
call GroupEnumUnitsInRange(G,GetUnitX(u),GetUnitY(u),area,Condition(function Filt))
call ForGroup(G,function Effects)
call SetUnitAnimation(u,"spin")
call GroupAddUnit(CD,u)
call PolledWait2(.4)
call SetUnitAnimation(u,"stand")
call GroupRemoveUnit(CD,u)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope CullingBlade
globals
private integer abil_id = 'A01Q' // Culling Blade ability rawcode
endglobals
private function Life takes integer lvl returns real
if lvl==1 then //Life at which the spell will insta-kill
return 300.
elseif lvl==2 then
return 450.
else
return 625.
endif
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local real life = GetWidgetLife(GetSpellTargetUnit())
if life<Life(GetUnitAbilityLevel(GetTriggerUnit(),abil_id)) then
call UnitDamageTarget(GetTriggerUnit(),GetSpellTargetUnit(),99999.,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope BloodBath
globals
private integer abil_id = 'A01S' // Blood Bath ability rawcode
private real unit_id = .05 // Factor per level for units killed
private real hero_id = .1 // Factor per level for heroes killed
private string SFX = "Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl" // Effect created on killer
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetKillingUnit(),abil_id)>0 and not IsUnitType(GetDyingUnit(),UNIT_TYPE_STRUCTURE)
endfunction
private function Actions takes nothing returns nothing
local real hp
local effect sfx = AddSpecialEffectTarget(SFX,GetKillingUnit(),"overhead")
if(IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO))then
set hp = hero_id
else
set hp = unit_id
endif
set hp = GetUnitAbilityLevel(GetKillingUnit(),abil_id)*hp*GetUnitState(GetDyingUnit(),UNIT_STATE_MAX_LIFE)
call SetWidgetLife(GetKillingUnit(),GetUnitState(GetKillingUnit(),UNIT_STATE_LIFE)+hp)
call PolledWait2(1.)
call DestroyEffect(sfx)
set sfx = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=43
//TESH.alwaysfold=0
scope Rupture
globals
private integer abil_id = 'A01W' // Rupture ability rawcode
private integer dum_id = 'A01V' // Rupture Buff ability rawcode
private integer buff_id = 'B00L' // Rupture buff rawcode
private string SFX = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl" // Effect created
endglobals
private function Damage_Init takes integer lvl returns real
return 50+(100.*lvl) // Initial damage/lvl
endfunction
private function Damage takes integer lvl returns real
return .2*lvl // Damage/lvl for move distance
endfunction
private function Time takes integer lvl returns real
return 3.+(2.*lvl) // Time/lvl
endfunction
private struct data
unit u
unit targ
real x
real y
integer lvl
timer t
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local real x
local real y
local real r
if GetWidgetLife(d.targ)<.405 then
call PauseTimer(d.t)
return
endif
set x = GetUnitX(d.targ)
set y = GetUnitY(d.targ)
set r = DBPXY(d.x,d.y,x,y)
if r>200. then
set r = 0.
endif
if r>1. then
call UnitDamageTarget(d.u,d.targ,Damage(d.lvl)*r,false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,null)
call DestroyEffect(AddSpecialEffectTarget(SFX,d.targ,"chest"))
endif
set d.x = x
set d.y = y
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local unit dum
set d.u = GetTriggerUnit()
set d.targ = GetSpellTargetUnit()
set d.x = GetUnitX(d.targ)
set d.y = GetUnitY(d.targ)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.t = NewTimer()
call TimerStart(d.t,.2,true,function Effects)
call SetData(d.t,d)
call UnitDamageTarget(d.u,d.targ,Damage_Init(d.lvl),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,null)
set dum = CreateUnit(GetOwningPlayer(d.targ),CasterUnitId,d.x,d.y,0.)
call UnitAddAbility(dum,dum_id)
call UnitApplyTimedLife(dum,'BTLF',Time(d.lvl))
call PolledWait2(Time(d.lvl))
call UnitRemoveAbility(d.targ,buff_id)
call EndTimer(d.t)
call d.destroy()
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope StrygwyrThirst
globals
private integer abil_id = 'A01U' // Thirst ability rawcode
private integer dum_id = 'A01T' // Thirst(Speed) ability rawcode
private integer buff_id = 'B00K' // Thirst buff rawcode
private real area = 1500. // Area to check per level
private real percent = .5 // Under which life is needed to be for effects to occur
private unit U = null
private integer LVL = 0
private boolean B = false
private group G = CreateGroup()
endglobals
private struct data
unit u
timer t
endstruct
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id and GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1
endfunction
private function Filt takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(U))
endfunction
private function Effects takes nothing returns nothing
local real dist = DBU(U,GetEnumUnit())
if GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE)<.405 or GetUnitState(U,UNIT_STATE_LIFE)<.405 then
call UnitShareVision(GetEnumUnit(),GetOwningPlayer(U),false)
else
if dist>LVL*area or GetWidgetLife(GetEnumUnit())/GetUnitState(GetEnumUnit(),UNIT_STATE_MAX_LIFE)>percent then
call UnitShareVision(GetEnumUnit(),GetOwningPlayer(U),false)
elseif dist<=LVL*area and GetWidgetLife(GetEnumUnit())/GetUnitState(GetEnumUnit(),UNIT_STATE_MAX_LIFE)<percent then
call UnitShareVision(GetEnumUnit(),GetOwningPlayer(U),true)
set B = true
endif
endif
endfunction
private function Acts takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local unit dum
set U = d.u
set LVL = GetUnitAbilityLevel(d.u,abil_id)
set B = false
call GroupClear(G)
call GroupEnumUnitsInRect(G,GetWorldBounds(),Condition(function Filt))
call ForGroup(G,function Effects)
if B then
set dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
call UnitAddAbility(dum,dum_id)
call SetUnitAbilityLevel(dum,dum_id,LVL)
call IssueTargetOrderById(dum,OrderId("bloodlust"),d.u)
call UnitApplyTimedLife(dum,'BTLF',1.)
set dum = null
else
call UnitRemoveAbility(d.u,buff_id)
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.t = NewTimer()
call TimerStart(d.t,.5,true,function Acts)
call SetData(d.t,d)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FleshHeap
globals
private integer abil_id = 'A02Q' // Flesh Heap ability rawcode
private real str_unit = .03 // Strength gain per lvl for killing normal units
private real str_hero = .3 // Strength gain per lvl for killing heroes
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetKillingUnit(),abil_id)>0
endfunction
private function Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local string s = I2S(H2I(u))
local real r = GetReal(s,"FH")
if(IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO))then
set r=r+str_hero*GetUnitAbilityLevel(u,abil_id)
else
set r=r+str_unit*GetUnitAbilityLevel(u,abil_id)
endif
if(r>=1.)then
set r=r-1.
call SetHeroStr(u,GetHeroStr(u,false)+1,true)
endif
call SetReal(s,"FH",r)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=71
//TESH.alwaysfold=0
scope MeatHook
globals
private integer abil_id = 'A02T' // Meat Hook ability rawcode
private integer dummy_id = 'u00A' // Chain Link unit rawcode
private real distance = 40. // Distance between links
private string sfx = "Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl" // Effect created on target
private group G = CreateGroup()
private unit U = null
endglobals
private function Damage takes integer lvl returns real
return 100.*lvl // Damage/lvl
endfunction
private function Links takes integer lvl returns integer
return 5+6*lvl // Links/lvl - make sure this gets no greater then 50
endfunction
private struct data
unit u
unit targ
unit array link[51]
player p
real ang
real sin
real cos
integer lvl
integer count = 0
timer t
boolean extend = true
method onDestroy takes nothing returns nothing
if .targ!=null then
call PauseUnit(.targ,false)
call SetUnitPathing(.targ,true)
endif
call EndTimer(.t)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return GetFilterUnit()!=U and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local real x
local real y
if d.extend then
set d.count = d.count + 1
else
set d.count = d.count - 1
endif
if d.extend==false and d.count==0 then
call d.destroy()
return
endif
if d.count>Links(d.lvl) then
set d.extend = false
set d.count = d.count - 1
endif
if d.extend then
set x = SafeX(GetUnitX(d.u)+distance*d.count*d.cos)
set y = SafeY(GetUnitY(d.u)+distance*d.count*d.sin)
set d.link[d.count] = CreateUnit(d.p,dummy_id,x,y,d.ang)
call GroupClear(G)
set U = d.u
call GroupEnumUnitsInRange(G,x,y,150.,Condition(function Filt))
set d.targ = FirstOfGroup(G)
if d.targ!=null then
if IsUnitEnemy(d.targ,d.p) then
call DestroyEffect(AddSpecialEffectTarget(sfx,d.targ,"chest"))
call UnitDamageTarget(d.u,d.targ,Damage(d.lvl),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_ENHANCED,null)
endif
call PauseUnit(d.targ,true)
call SetUnitPathing(d.targ,true)
set d.extend = false
set d.count = d.count + 1
endif
else
if d.targ!=null then
call SetUnitX(d.targ,GetUnitX(d.link[d.count]))
call SetUnitY(d.targ,GetUnitY(d.link[d.count]))
endif
call ShowUnit(d.link[d.count],false)
call KillUnit(d.link[d.count])
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local location l
local real x
local real y
if GetSpellTargetUnit()==null then
set l = GetSpellTargetLoc()
else
set l = GetUnitLoc(GetSpellTargetUnit())
endif
set x = GetLocationX(l)
set y = GetLocationY(l)
set d.u = GetTriggerUnit()
set d.p = GetOwningPlayer(d.u)
set d.ang = ABPXY(GetUnitX(d.u),GetUnitY(d.u),x,y)
set d.cos = Cos(d.ang*bj_DEGTORAD)
set d.sin = Sin(d.ang*bj_DEGTORAD)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.t = NewTimer()
call TimerStart(d.t,.03,true,function Effects)
call SetData(d.t,d)
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Rot
globals
private integer abil_id = 'A02R' // Rot ability rawcode
private integer dum_id = 'A02S' // Rot slow ability rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),abil_id)>0
endfunction
private function Actions takes nothing returns nothing
if(GetIssuedOrderId()==OrderId("immolation"))then
call UnitAddAbility(GetTriggerUnit(),dum_id)
elseif(GetIssuedOrderId()==OrderId("unimmolation"))then
call UnitRemoveAbility(GetTriggerUnit(),dum_id)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope Backtrack
globals
private integer abil_id = 'A018' // Backtrack ability rawcode
private real base = .05 // Base chance to backtrack
private real chance = .05 // Chance/lvl to backtrack
private string sfx = "Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl" // Effect created on backtrack
endglobals
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
local real dam = GetEventDamage()
if dam>.1 then
if(GetRandomReal(0.,1.)<=(base+(chance*GetUnitAbilityLevel(u,abil_id))))then
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+dam)
call DestroyEffect(AddSpecialEffectTarget(sfx,u,"hand,left"))
endif
endif
set u = null
endfunction
private function Actions takes nothing returns nothing
local trigger t
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set t = CreateTrigger()
call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddAction(t,function Acts)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=25
//TESH.alwaysfold=0
scope Chronosphere
globals
private integer abil_id = 'A017' // Chronosphere ability rawcode
private integer dummy_id = 'u006' // Chronosphere unti rawcode
private real area = 425. // Area for stop
private unit U = null
private group G = CreateGroup()
endglobals
private function Time takes integer lvl returns real
return 2.+(lvl) // Duration/lvl
endfunction
private struct data
unit u
unit sphere
real x
real y
group grp
timer t
timer t2
real time = 0.
integer lvl
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function FX takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call SetUnitTimeScale(d.sphere,0)
call EndTimer(d.t2)
endfunction
private function Filt takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit())!=GetOwningPlayer(U) and GetWidgetLife(GetFilterUnit())>.405
endfunction
private function Start takes nothing returns nothing
call PauseUnit(GetEnumUnit(),true)
call SetUnitTimeScale(GetEnumUnit(),0)
endfunction
private function End takes nothing returns nothing
call PauseUnit(GetEnumUnit(),false)
call SetUnitTimeScale(GetEnumUnit(),1)
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call ForGroup(d.grp,function End)
call GroupClear(G)
set U = d.u
call GroupEnumUnitsInRange(G,d.x,d.y,area,Condition(function Filt))
call GroupClear(d.grp)
call GroupAddGroup(G,d.grp)
call ForGroup(d.grp,function Start)
set d.time = d.time + .1
if d.time>Time(d.lvl) then
call ForGroup(d.grp,function End)
call RemoveUnit(d.sphere)
call DestroyGroup(d.grp)
call EndTimer(d.t)
call d.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local location l = GetSpellTargetLoc()
set d.u = GetTriggerUnit()
set d.x = GetLocationX(l)
set d.y = GetLocationY(l)
set d.sphere = CreateUnit(GetOwningPlayer(d.u),dummy_id,d.x,d.y,0.)
set d.grp = CreateGroup()
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.t = NewTimer()
call TimerStart(d.t,.1,true,function Effects)
call SetData(d.t,d)
set d.t2 = NewTimer()
call TimerStart(d.t2,.8,false,function FX)
call SetData(d.t2,d)
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope TimeWalk
globals
private integer abil_id = 'A01A' // Time Walk ability rawcode
private integer dum_id = 'A01B' // Time Walk(dummy) ability rawcode
endglobals
private struct data
unit u
real cos
real sin
real dist
real time = 0.
timer t
method onDestroy takes nothing returns nothing
local unit dum = CreateUnit(GetOwningPlayer(.u),CasterUnitId,GetUnitX(.u),GetUnitY(.u),0.)
call UnitAddAbility(dum,dum_id)
call SetUnitAbilityLevel(dum,dum_id,GetUnitAbilityLevel(.u,abil_id))
call UnitApplyTimedLife(dum,'BTLF',2.)
call IssueImmediateOrderById(dum,OrderId("thunderclap"))
call SetUnitPathing(.u,true)
call SetUnitAnimation(.u,"stand")
call SetUnitInvulnerable(.u,false)
call SetUnitVertexColor(.u,255,255,255,255)
if GetLocalPlayer()==GetOwningPlayer(.u) then
call ClearSelection()
call SelectUnit(.u,true)
endif
call EndTimer(.t)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Walk takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call SetUnitPosition(d.u,SafeX(GetUnitX(d.u)+d.dist/40*d.cos),SafeY(GetUnitY(d.u)+d.dist/40*d.sin))
set d.time = d.time + .01
if d.time>=.4 then
call d.destroy()
return
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local location l
local real x
local real y
local real ang
if GetSpellTargetUnit()==null then
set l = GetSpellTargetLoc()
else
set l = GetUnitLoc(GetSpellTargetUnit())
endif
set x = GetLocationX(l)
set y = GetLocationY(l)
set d.u = GetTriggerUnit()
set ang = ABPXY(GetUnitX(d.u),GetUnitY(d.u),x,y)
set d.cos = Cos(ang*bj_DEGTORAD)
set d.sin = Sin(ang*bj_DEGTORAD)
set d.dist = DBPXY(GetUnitX(d.u),GetUnitY(d.u),x,y)
set d.t = NewTimer()
call TimerStart(d.t,.01,true,function Walk)
call SetData(d.t,d)
call SetUnitAnimationByIndex(d.u,0)
call SetUnitPathing(d.u,false)
call SetUnitInvulnerable(d.u,true)
call SetUnitVertexColor(d.u,0,0,0,191)
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum_id)
endfunction
endscope
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope AphoticShield
globals
private integer abil_id = 'A020' // Aphotic Shield ability rawcode
private integer dum_id = 'A021' // Aphotic Shield Damage ability rawcode
private real Time = 20. // Duration of spell
private real Area = 700. // Area for damage explosion
private string SFX = "Models\\AphoticShield.mdx" // Effect created on target
private unit U = null
private real R = 0.
private group G = CreateGroup()
endglobals
private function Damage takes integer lvl returns real
return 75.+(50.*lvl) // Damage absorbed/lvl
endfunction
private struct data
unit u
trigger trig
effect sfx
real hp
integer lvl
boolean b = false
method onDestroy takes nothing returns nothing
call DestroyTrigger(.trig)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(U)) and GetWidgetLife(GetFilterUnit())>.405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
private function Explode takes nothing returns nothing
set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(U),CasterUnitId,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),0.)
call UnitAddAbility(bj_lastCreatedUnit,dum_id)
call SetUnitAbilityLevel(bj_lastCreatedUnit,dum_id,GetUnitAbilityLevel(U,abil_id))
call IssueTargetOrderById(bj_lastCreatedUnit,OrderId("forkedlightning"),GetEnumUnit())
call UnitApplyTimedLife(bj_lastCreatedUnit,'BTLF',1.)
endfunction
private function Life takes nothing returns nothing
call SetWidgetLife(U,GetWidgetLife(U)+R)
call EndTimer(GetExpiredTimer())
endfunction
private function Effects takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
local real dam = GetEventDamage()
if dam<.1 then
return false
endif
if d.hp>dam then
set d.hp = d.hp - dam
set U = d.u
set R = dam
call TimerStart(NewTimer(),0.,false,function Life)
return false
endif
set U = d.u
set R = dam - (dam-d.hp)
call TimerStart(NewTimer(),0.,false,function Life)
set d.b = true
call DestroyEffect(d.sfx)
call DisableTrigger(d.trig)
call GroupClear(G)
call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),Area,Condition(function Filt))
call ForGroup(G,function Explode)
return false
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetSpellTargetUnit()
set d.trig = CreateTrigger()
call TriggerRegisterUnitEvent(d.trig,d.u,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(d.trig,Condition(function Effects))
call SetData(d.trig,d)
set d.sfx = AddSpecialEffectTarget(SFX,d.u,"chest")
set d.lvl = GetUnitAbilityLevel(GetTriggerUnit(),abil_id)
set d.hp = Damage(d.lvl)
call PolledWait2(Time)
if d.b==false then
call DestroyEffect(d.sfx)
endif
call d.destroy()
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope BorrowedTime
globals
private integer abil_id = 'A022' // Borrowed Time ability rawcode
private real Life = 400. // Life at which spell triggers
private string Sfx = "Abilities\\Spells\\Undead\\Unsummon\\UnsummonTarget.mdl" // Effect created on unit
private unit U = null
private real R = 0.
endglobals
private function Duration takes integer lvl returns real
if lvl==1 then // Duration of effect
return 3.
elseif lvl==2 then
return 4.
else
return 5.
endif
endfunction
private struct data
unit u
timer t
endstruct
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Conds takes nothing returns boolean
if GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT and GetSpellAbilityId()==abil_id then
return true
elseif GetTriggerEventId()==EVENT_UNIT_DAMAGED and GetEventDamage()>1. then
return true
endif
return false
endfunction
private function End_CD takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local string s = I2S(H2I(d.u))
call SetBool(s,"BTOn",false)
call EndTimer(d.t)
call d.destroy()
endfunction
private function End_FX takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local string s = I2S(H2I(d.u))
call SetBool(s,"BTDuration",false)
call DestroyEffect(GetEffect(s,"BTFX"))
call EndTimer(d.t)
call d.destroy()
endfunction
private function Heal takes nothing returns nothing
call SetWidgetLife(U,GetWidgetLife(U)+R)
call EndTimer(GetExpiredTimer())
endfunction
private function Acts takes nothing returns nothing
local string s = I2S(H2I(GetTriggerUnit()))
local boolean b_On = GetBool(s,"BTOn")
local boolean b_Dur = GetBool(s,"BTDuration")
local data d
if b_Dur then
set U = GetTriggerUnit()
set R = GetEventDamage()
call TimerStart(NewTimer(),0.,false,function Heal)
elseif(b_On==false and((GetTriggerEventId()==EVENT_UNIT_DAMAGED and GetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE)<Life)or(GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT)))then
call UnitRemoveBuffs(GetTriggerUnit(),false,true)
if(GetTriggerEventId()==EVENT_UNIT_DAMAGED)then
call DisableTrigger(GetTriggeringTrigger())
call IssueImmediateOrderById(GetTriggerUnit(),OrderId("windwalk"))
call EnableTrigger(GetTriggeringTrigger())
endif
call SetBool(s,"BTOn",true)
call SetBool(s,"BTDuration",true)
call SetObject(s,"BTFX",AddSpecialEffectTarget(Sfx,GetTriggerUnit(),"origin"))
set d = data.create()
set d.t = NewTimer()
set d.u = GetTriggerUnit()
call TimerStart(d.t,Duration(GetUnitAbilityLevel(GetTriggerUnit(),abil_id)),false,function End_FX)
call SetData(d.t,d)
set d = data.create()
set d.t = NewTimer()
set d.u = GetTriggerUnit()
call TimerStart(d.t,45.,false,function End_CD)
call SetData(d.t,d)
endif
endfunction
private function Actions takes nothing returns nothing
local trigger t
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set t = CreateTrigger()
call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerRegisterUnitEvent(t,GetTriggerUnit(),EVENT_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function Acts)
call TriggerAddCondition(t,Condition(function Conds))
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=8
//TESH.alwaysfold=0
scope DeathCoil
globals
private integer abil_id = 'A01X' // Death Coil ability rawcode
private string SFX = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" // Effect created
private unit U = null
endglobals
private function Damage takes integer lvl returns real
return 50+(50.*lvl) // Damage/lvl
endfunction
private function Health takes integer lvl returns real
return 25+(25.*lvl) // Health lost/lvl
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Effects takes nothing returns nothing
call UnitDamageTarget(U,U,Health(GetUnitAbilityLevel(U,abil_id)),false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit targ = GetSpellTargetUnit()
local real r = Damage(GetUnitAbilityLevel(u,abil_id))
local timer t = NewTimer()
call DestroyEffect(AddSpecialEffectTarget(SFX,targ,"origin"))
if IsUnitAlly(targ,GetOwningPlayer(u))then
call SetUnitState(targ,UNIT_STATE_LIFE,GetUnitState(targ,UNIT_STATE_LIFE)+r)
else
call UnitDamageTarget(u,targ,r,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
endif
set U = u
call TimerStart(t,0.,false,function Effects)
set targ = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope Frostmourne
globals
private integer abil_id = 'A01Z' // Frostmourne ability rawcode
private integer abil2_id = 'A01Y' // Mark effect ability rawcode
private integer buff_id = 'B00M' // Frostmourne buff rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),buff_id)>0
endfunction
private function Actions takes nothing returns nothing
local unit u = GetAttacker()
local unit targ = GetTriggerUnit()
local unit dum = CreateUnit(GetOwningPlayer(u),CasterUnitId,GetUnitX(u),GetUnitY(u),0.)
local integer lvl = GetUnitAbilityLevel(u,abil_id)
if lvl>0 then
call SetInt(I2S(H2I(targ))+"MotA","lvl",lvl)
else
set lvl = GetInt(I2S(H2I(targ))+"MotA","lvl")
endif
call UnitAddAbility(dum,abil2_id)
call SetUnitAbilityLevel(dum,abil2_id,lvl)
call IssueTargetOrderById(dum,OrderId("bloodlust"),u)
call UnitApplyTimedLife(dum,'BTLF',1.)
set u = null
set targ = null
set dum = null
endfunction
private function Death takes nothing returns nothing
call CT(I2S(H2I(GetTriggerUnit()))+"MotA")
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(trig,function Death)
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope Burrowstrike
globals
private integer abil_id = 'A02B' // Burrowstrike ability rawcode
private integer dum1_id = 'A02C' // BSImaple (1) ability rawcode
private integer dum2_id = 'A02D' // BSImaple (2) ability rawcode
private integer dum3_id = 'A02E' // BSImaple (3) ability rawcode
private integer dum4_id = 'A02F' // BSImaple (4) ability rawcode
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u,abil_id)
local location l = GetSpellTargetLoc()
local location lu = GetUnitLoc(u)
local real ang = AngleBetweenPoints(lu,l)
local unit dum = CreateUnitAtLoc(GetOwningPlayer(u),CasterUnitId,lu,ang)
local integer id
if lvl==1 then
set id = dum1_id
elseif lvl==2 then
set id = dum2_id
elseif lvl==3 then
set id = dum3_id
else
set id = dum4_id
endif
call UnitAddAbility(dum,id)
call SetUnitAbilityLevel(dum,id,R2I(DistanceBetweenPoints(lu,l))/100)
call IssuePointOrderByIdLoc(dum,OrderId("impale"),l)
call UnitApplyTimedLife(dum,'BTLF',1.)
call PolledWait2((DistanceBetweenPoints(lu,l)/4000.))
call SetUnitX(u,SafeX(GetLocationX(l)))
call SetUnitY(u,SafeY(GetLocationY(l)))
call SetUnitAnimation(u,"morph ALTERNATE")
call RemoveLocation(l)
set l = null
call RemoveLocation(lu)
set lu = null
set dum = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum1_id)
call PreLoadAbil(dum2_id)
call PreLoadAbil(dum3_id)
call PreLoadAbil(dum4_id)
endfunction
endscope
//TESH.scrollpos=33
//TESH.alwaysfold=0
scope Epicenter
globals
private integer abil_id = 'A028' // Epicenter ability rawcode
private integer dummy_id = 'A029' // Epicenter (Dummy) ability rawcode
private real interval = .35 // Time between hits
private location L = null
endglobals
private function Hits takes integer lvl returns integer
return 4+(lvl*2) //Number of hits/lvl
endfunction
private struct data
unit u
integer lvl
integer count = 0
timer t
unit dum
method onDestroy takes nothing returns nothing
call EndTimer(.t)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
set d.count = d.count + 1
if d.count>Hits(d.lvl) then
call d.destroy()
return
endif
set d.dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
call UnitAddAbility(d.dum,dummy_id)
call SetUnitAbilityLevel(d.dum,dummy_id,d.count)
call IssueImmediateOrderById(d.dum,OrderId("thunderclap"))
call UnitApplyTimedLife(d.dum,'BTLF',1.)
set L = GetUnitLoc(d.u)
call TerrainDeformationRippleBJ(.03,false,L,(150.+(100.*I2R(d.count))),(150.+(100.*I2R(d.count))),72.,.03,512)
call RemoveLocation(L)
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
set d.t = NewTimer()
call TimerStart(d.t,interval,true,function Effects)
call SetData(d.t,d)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_FINISH)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dummy_id)
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope SandStorm
globals
private integer abil_id = 'A02G' // Sand Storm ability rawcode
private integer dum1_id = 'A02H' // Sand Storm Invisibility ability rawcode
private integer dum2_id = 'A02I' // Sand Storm Damage ability rawcode
private integer dummy_id = 'e005' // Sand Storm unit rawcode
private integer buff_id = 'B00R' // Sand Storm buff rawcode
endglobals
private function Time takes integer lvl returns real
return 20.*lvl // Length/lvl
endfunction
private function Invis takes integer lvl returns real
return .3*lvl // Length of time before returning visible
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer lvl = GetUnitAbilityLevel(u,abil_id)
local unit dum1 = CreateUnit(p,dummy_id,GetUnitX(u),GetUnitY(u),0.)
local unit array dum2
call SetUnitPathing(dum1,false)
call SetUnitInvulnerable(dum1,true)
call UnitAddAbility(dum1,dum1_id)
call UnitAddAbility(dum1,dum2_id)
call PolledWait2(.25)
call SetUnitAbilityLevel(dum1,dum1_id,lvl)
call SetUnitAbilityLevel(dum1,dum2_id,lvl)
call IssueImmediateOrderById(dum1,OrderId("immolation"))
call IssueTargetOrderById(dum1,OrderId("invisibility"),u)
set dum2[1]=CreateUnit(p,dummy_id,GetUnitX(u)+150,GetUnitY(u)+150,0.)
call SetUnitTimeScale(dum2[1],0.)
call SetUnitPathing(dum2[1],false)
call SetUnitInvulnerable(dum2[1],true)
set dum2[2]=CreateUnit(p,dummy_id,GetUnitX(u)+150,GetUnitY(u)-150,0.)
call SetUnitTimeScale(dum2[2],0.)
call SetUnitPathing(dum2[2],false)
call SetUnitInvulnerable(dum2[2],true)
set dum2[3]=CreateUnit(p,dummy_id,GetUnitX(u)-150,GetUnitY(u)+150,0.)
call SetUnitTimeScale(dum2[3],0.)
call SetUnitPathing(dum2[3],false)
call SetUnitInvulnerable(dum2[3],true)
set dum2[4]=CreateUnit(p,dummy_id,GetUnitX(u)-150,GetUnitY(u)-150,0.)
call SetUnitTimeScale(dum2[4],0.)
call SetUnitPathing(dum2[4],false)
call SetUnitInvulnerable(dum2[4],true)
call PolledWait2(Time(lvl))
if dum2[1]!=null then
call RemoveUnit(dum2[1])
set dum2[1] = null
call RemoveUnit(dum2[2])
set dum2[2] = null
call RemoveUnit(dum2[3])
set dum2[3] = null
call RemoveUnit(dum2[4])
set dum2[4] = null
call RemoveUnit(dum1)
set dum1 = null
endif
endfunction
private function Conditions2 takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
function Filt2 takes nothing returns boolean
return(GetUnitTypeId(GetFilterUnit())==dummy_id)
endfunction
function End2 takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
private function Actions2 takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = CreateGroup()
call PolledWait2(Invis(GetUnitAbilityLevel(u,abil_id)))
call GroupEnumUnitsOfPlayer(g,GetOwningPlayer(u),Condition(function Filt2))
call ForGroup(g,function End2)
call UnitRemoveAbility(u,buff_id)
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(dum1_id)
call PreLoadAbil(dum2_id)
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_ENDCAST)
call TriggerAddAction( trig, function Actions2 )
call TriggerAddCondition(trig,Condition(function Conditions2))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope ChargeofDarkness
globals
private integer abil_id = 'A01L' // Charge of Darkness ability rawcode
private integer abil2_id = 'A01G' // Charge of Darkness(Buff) ability rawcode
private integer abil3_id = 'A01F' // Charge of Darkness Stun ability rawcode
private integer charge1_id = 'A02U' // Charge(MS) ability rawcode
private integer buff_id = 'B00E' // Charge of Darkness(Target) buff rawcode
private integer buff2_id = 'B00D' // Charge of Darkness(Caster) buff rawcode
endglobals
private struct data
unit u
unit targ
integer lvl
unit aura
integer runs = 0
timer t
trigger attack
trigger stop
method onDestroy takes nothing returns nothing
call RemoveUnit(.aura)
call EndTimer(.t)
call DestroyTrigger(.attack)
call DestroyTrigger(.stop)
call SetUnitPathing(.u,true)
call SetUnitVertexColor(.u,255,255,255,255)
call UnitRemoveAbility(.targ,buff_id)
call UnitRemoveAbility(.u,buff2_id)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function SpeedUp takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call SetUnitVertexColorBJ(d.u,100,100,100,d.runs*d.lvl)
set d.runs = d.runs + 1
if ModuloInteger(d.runs,4)==0 then
call SetUnitAbilityLevel(d.aura,charge1_id,GetUnitAbilityLevel(d.aura,charge1_id)+d.lvl)
endif
call DisableTrigger(d.attack)
call DisableTrigger(d.stop)
call IssueTargetOrderById(d.u,OrderId("attack"),d.targ)
call EnableTrigger(d.attack)
call EnableTrigger(d.stop)
if GetUnitAbilityLevel(d.targ,buff_id)==0 then
call IssueTargetOrderById(d.u,OrderId("attack"),d.targ)
endif
endfunction
private function Attack takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
local unit dum
if GetAttacker()!=d.u then
return false
endif
set dum = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.targ),GetUnitY(d.targ),0.)
call DisableTrigger(d.attack)
call DisableTrigger(d.stop)
call PauseTimer(d.t)
call UnitAddAbility(dum,abil3_id)
call SetUnitAbilityLevel(dum,abil3_id,d.lvl)
call IssueTargetOrderById(dum,OrderId("thunderbolt"),d.targ)
call UnitApplyTimedLife(dum,'BTLF',1.)
call d.destroy()
set dum = null
return false
endfunction
private function Stop takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
call DisableTrigger(d.attack)
call DisableTrigger(d.stop)
call PauseTimer(d.t)
call d.destroy()
return false
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.targ = GetSpellTargetUnit()
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
call UnitShareVision(d.targ,GetOwningPlayer(d.u),true)
set d.aura = CreateUnit(GetOwningPlayer(d.u),CasterUnitId,GetUnitX(d.u),GetUnitY(d.u),0.)
call UnitAddAbility(d.aura,abil2_id)
call UnitAddAbility(d.aura,charge1_id)
call SetUnitAbilityLevel(d.aura,charge1_id,d.lvl)
call TriggerSleepAction(0.)
call IssueTargetOrderById(d.aura,OrderId("faeriefire"),d.targ)
call IssueTargetOrderById(d.u,OrderId("attack"),d.targ)
call SetUnitPathing(d.u,false)
set d.t = NewTimer()
call TimerStart(d.t,1.,true,function SpeedUp)
call SetData(d.t,d)
set d.attack = CreateTrigger()
call TriggerRegisterUnitEvent(d.attack,d.targ,EVENT_UNIT_ATTACKED)
call TriggerAddCondition(d.attack,Condition(function Attack))
call SetData(d.attack,d)
set d.stop = CreateTrigger()
call TriggerRegisterUnitEvent(d.stop,d.u,EVENT_UNIT_ISSUED_ORDER)
call TriggerRegisterUnitEvent(d.stop,d.u,EVENT_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterUnitEvent(d.stop,d.u,EVENT_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterUnitEvent(d.stop,d.u,EVENT_UNIT_DEATH)
call TriggerRegisterUnitEvent(d.stop,d.targ,EVENT_UNIT_DEATH)
call TriggerAddCondition(d.stop,Condition(function Stop))
call SetData(d.stop,d)
call TriggerSleepAction(0.)
call UnitShareVision(d.targ,GetOwningPlayer(d.u),false)
if GetWidgetLife(d.u)<.405 then
call d.destroy()
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
call PreLoadAbil(abil3_id)
call PreLoadAbil(charge1_id)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EmpoweringHaste
globals
private integer abil_id = 'A01C' // Empowering Haste ability rawcode
private group G = CreateGroup()
endglobals
private function Damage takes real ms, integer lvl returns real
return ms*.04*lvl // Damage done given movespeed(ms) and level(lvl)
endfunction
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Conds takes nothing returns boolean
return not IsUnitInGroup(GetAttacker(),G) and GetUnitAbilityLevel(GetAttacker(),abil_id)>0 and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetAttacker()))
endfunction
private function Acts takes nothing returns nothing
local unit u = GetAttacker()
local unit targ = GetTriggerUnit()
local real ms = GetUnitMoveSpeed(u)
local real dam = Damage(ms,GetUnitAbilityLevel(u,abil_id))
call GroupAddUnit(G,u)
call UnitDamageTarget(u,targ,dam,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,null)
call PolledWait2(.5)
call GroupRemoveUnit(G,u)
set targ = null
endfunction
private function Actions takes nothing returns nothing
local trigger t
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function Acts)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
set trig = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope GreaterBash
globals
private integer abil_id = 'A01D' // Greater Bash ability rawcode
private real chance = .17 // Chance to fire/attack
private string sfx = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" // Effect created when fired
private string sfx2 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" // Effect created during slide
endglobals
private function Damage takes integer lvl returns real
return 25.*lvl // Damage done
endfunction
private function Length takes integer lvl returns real
return .4+lvl*.2 // Duration of slide
endfunction
private struct data
timer t
unit u
unit targ
real cos
real sin
real move = 2.
integer brake = 0
integer lvl
method onDestroy takes nothing returns nothing
call PauseUnit(.targ,false)
call EndTimer(.t)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetLearnedSkill()==abil_id
endfunction
private function Conds takes nothing returns boolean
local data d = GetData(GetTriggeringTrigger())
if GetAttacker()!=d.u then
return false
endif
return not IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE) and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetAttacker())) and GetRandomReal(0.,1.)<=chance
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
if d.brake==1 then
set d.move = d.move * .98
endif
if GetWidgetLife(d.targ)>.405 then
call SetUnitX(d.targ,SafeX(GetUnitX(d.targ)+d.move*d.cos))
call SetUnitY(d.targ,SafeY(GetUnitY(d.targ)+d.move*d.sin))
call DestroyEffect(AddSpecialEffect(sfx2,GetUnitX(d.targ),GetUnitY(d.targ)))
call KillTrees(GetUnitX(d.targ),GetUnitY(d.targ),150.)
endif
endfunction
private function Acts takes nothing returns nothing
local data d = data.create()
local real ang
set d.t = NewTimer()
set d.u = GetAttacker()
set d.targ = GetTriggerUnit()
call PauseUnit(d.targ,true)
set ang = ABU(d.u,d.targ)
set d.cos = Cos(ang*bj_DEGTORAD)
set d.sin = Sin(ang*bj_DEGTORAD)
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
call DestroyEffect(AddSpecialEffectTarget(sfx,d.u,"weapon"))
call DisableTrigger(GetTriggeringTrigger())
call UnitDamageTarget(d.u,d.targ,Damage(d.lvl),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
call TimerStart(d.t,.01,true,function Effects)
call SetData(d.t,d)
call TriggerSleepAction(0.)
set d.brake = 1
call PolledWait2(Length(d.lvl))
call d.destroy()
call EnableTrigger(GetTriggeringTrigger())
endfunction
private function Actions takes nothing returns nothing
local trigger t
local data d
if GetUnitAbilityLevel(GetTriggerUnit(),abil_id)==1 then
set t = CreateTrigger()
set d = data.create()
set d.u = GetTriggerUnit()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function Acts)
call SetData(t,d)
endif
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=33
//TESH.alwaysfold=0
scope NetherStrike
globals
private integer abil_id = 'A01E' // Nether Strike ability rawcode
private integer abil2_id = 'A01D' // Greater Bash ability rawcode
private string sfx = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" // Effect created when Greater Bash fires
private string sfx2 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" // Effect created during slide
endglobals
private function Damage takes integer lvl returns real
return 100.*lvl // Damage/lvl
endfunction
private function Damage2 takes integer lvl returns real
return 25.*lvl // Damage done by Greater Bash
endfunction
private function Length takes integer lvl returns real
return .4+lvl*.2 // Length of slide for Greater Bash
endfunction
private struct data
unit u
unit targ
timer t
trigger trig
integer fade = 0
endstruct
private struct data_more
timer t
unit u
unit targ
real cos
real sin
real move = 2.
real time = 0.
integer brake = 0
integer lvl
method onDestroy takes nothing returns nothing
call PauseUnit(.targ,false)
call EndTimer(.t)
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Effects takes nothing returns nothing
local data_more d = GetData(GetExpiredTimer())
set d.time = d.time + .01
if d.time>Length(d.lvl) then
call d.destroy()
return
endif
if d.time>.2 and d.brake==0 then
set d.brake = 1
endif
if d.brake==1 then
set d.move = d.move * .98
endif
if GetWidgetLife(d.targ)>.405 then
call SetUnitX(d.targ,SafeX(GetUnitX(d.targ)+d.move*d.cos))
call SetUnitY(d.targ,SafeY(GetUnitY(d.targ)+d.move*d.sin))
call DestroyEffect(AddSpecialEffect(sfx2,GetUnitX(d.targ),GetUnitY(d.targ)))
call KillTrees(GetUnitX(d.targ),GetUnitY(d.targ),150.)
endif
endfunction
private function GreaterBash takes unit u, unit targ returns nothing
local data_more d = data_more.create()
local real ang
set d.t = NewTimer()
set d.u = u
set d.targ = targ
call PauseUnit(d.targ,true)
set ang = ABU(d.u,d.targ)
set d.cos = Cos(ang*bj_DEGTORAD)
set d.sin = Sin(ang*bj_DEGTORAD)
set d.lvl = GetUnitAbilityLevel(d.u,abil2_id)
call DestroyEffect(AddSpecialEffectTarget(sfx,d.u,"weapon"))
call UnitDamageTarget(d.u,d.targ,Damage2(d.lvl),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
call TimerStart(d.t,.01,true,function Effects)
call SetData(d.t,d)
endfunction
private function FadeIn takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call SetUnitVertexColorBJ(d.u,100,100,100,d.fade)
set d.fade = d.fade + 1
endfunction
private function FadeOut takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
call SetUnitVertexColorBJ(d.u,100,100,100,d.fade)
set d.fade = d.fade - 1
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.targ = GetSpellTargetUnit()
set d.t = NewTimer()
set d.trig = CreateTrigger()
call UnitShareVision(d.targ,GetOwningPlayer(d.u),true)
call IssueImmediateOrder(d.u,"halt")
call TimerStart(d.t,.01,true,function FadeIn)
call SetData(d.t,d)
call PolledWait2(1.)
call PauseTimer(d.t)
call SetUnitPosition(d.u,GetUnitX(d.targ)+80.*Cos(ABU(d.u,d.targ)*bj_DEGTORAD),GetUnitY(d.targ)+80.*Sin(ABU(d.u,d.targ)*bj_DEGTORAD))
if GetUnitAbilityLevel(d.u,abil2_id)>0 then
call GreaterBash(d.u,d.targ)
endif
call SetUnitAnimation(d.u,"attack")
call IssueTargetOrderById(d.u,OrderId("attack"),d.targ)
call UnitDamageTarget(d.u,d.targ,Damage(GetUnitAbilityLevel(d.u,abil_id)),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
set d.fade = 100
call TimerStart(d.t,.01,true,function FadeOut)
call PolledWait2(1.)
call PauseTimer(d.t)
call SetUnitVertexColor(d.u,255,255,255,255)
call UnitShareVision(d.targ,GetOwningPlayer(d.u),false)
call EndTimer(d.t)
call d.destroy()
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope DiabolicEdict
globals
private integer abil_id = 'A014' // Diabolic Edict ability rawcode
private real Time = 8. // Duration of spell
private real Area = 500. // Area of spell
private string Sfx = "Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl" // Effect created on targets
private group G = CreateGroup()
private unit U = null
endglobals
private function Damage takes integer lvl returns real
return 12.5*lvl // Damage/lvl
endfunction
private function Speed takes integer lvl returns real
return .25 // Speed of timer/lvl
endfunction
private struct data
unit u
timer t
integer lvl
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId()==abil_id
endfunction
private function Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(U))and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>.405
endfunction
private function Effects takes nothing returns nothing
local data d = GetData(GetExpiredTimer())
local unit dum
call GroupClear(G)
set U = d.u
call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),Area,Condition(function Filt))
set dum = GroupPickRandomUnit(G)
if dum!=null then
call DestroyEffect(AddSpecialEffectTarget(Sfx,dum,"chest"))
call UnitDamageTarget(d.u,dum,Damage(d.lvl),true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set dum = null
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
set d.u = GetTriggerUnit()
set d.t = NewTimer()
set d.lvl = GetUnitAbilityLevel(d.u,abil_id)
call TimerStart(d.t,Speed(d.lvl),true,function Effects)
call SetData(d.t,d)
call PolledWait2(Time)
call EndTimer(d.t)
call d.destroy()
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Actions )
call TriggerAddCondition(trig,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=52
//TESH.alwaysfold=0
function Trig_Item_Set_Actions takes nothing returns nothing
// Normal
set udg_Ability [1] = 'A02K' // Adaptive Strike
set udg_Ability [2] = 'A009' // AfterShock
set udg_Ability [3] = 'A020' // Aphotic shield
set udg_Ability [4] = 'A00S' // Back Stab
set udg_Ability [5] = 'A018' // Backtrack
set udg_Ability [6] = 'A01O' // Battle Hunger
set udg_Ability [7] = 'A01M' // Besseker call
set udg_Ability [8] = 'A00C' // Blade Dance
set udg_Ability [9] = 'A00D' // Blade Fury
set udg_Ability [10] = 'A00U' // Blink Strike
set udg_Ability [11] = 'A01S' // Blood Bath
set udg_Ability [12] = 'A01R' // Blood Rage
set udg_Ability [13] = 'A00X' // Bristle Back
set udg_Ability [14] = 'A02B' // Burrow Strike
set udg_Ability [15] = 'A02A' // Caustic Finale
set udg_Ability [16] = 'A01L' // Charge Of Darkness
set udg_Ability [17] = 'A01P' // Counter Helix
set udg_Ability [18] = 'A00H' // Curse Of The Silence
set udg_Ability [19] = 'A01X' // DEath Coil
set udg_Ability [20] = 'A014' // Diabolic Edict
set udg_Ability [21] = 'A01C' // Empowering Haste
set udg_Ability [22] = 'A008' // Fissure
set udg_Ability [23] = 'A00I' // Glaive Of Wisdom
set udg_Ability [24] = 'A01D' // Greater Bash
set udg_Ability [25] = 'A00N' // Head Shot
set udg_Ability [26] = 'A015' // Lightning Strom
set udg_Ability [27] = 'A024' // Lucent Beam
set udg_Ability [28] = 'A023' // Lunar Blessing
set udg_Ability [29] = 'A02T' // Meat hook
set udg_Ability [30] = 'A010' // quil Spray
set udg_Ability [31] = 'A02R' // Rot
set udg_Ability [32] = 'A02G' // Sand Strom
set udg_Ability [33] = 'A00M' // Scatter Shot
set udg_Ability [34] = 'A0OT' // Smoke Screen
set udg_Ability [35] = 'A013' // Split Earth
set udg_Ability [36] = 'A01U' // Strygwyrs Thirts
set udg_Ability [37] = 'A019' // Time Lock
set udg_Ability [38] = 'A01A' // Time Walk
set udg_Ability [39] = 'A00Y' // Vicious Nassal
set udg_Ability [40] = 'A02J' // Wave Form
set udg_Ability [41] = 'A02Q' // Flesh Heap
set udg_Ability [42] = 'A006' // Enchant Totem
set udg_Ability [43] = 'A01Z' // Froustmourne
set udg_Ability [44] = 'A00B' // Healing WArd
set udg_Ability [45] = 'A00J' // last Word
set udg_Ability [46] = 'A025' // Moon Glaive
set udg_Ability [47] = 'A02L' // Morph
set udg_Ability [48] = 'A00O' // Take Aim
// uLtImAtE
set udg_Ability [49] = 'A00P' // assassinate
set udg_Ability [50] = 'A022' // Borrowed Time
set udg_Ability [51] = 'A017' // Chronosphere
set udg_Ability [52] = 'A01Q' // Culling Blade
set udg_Ability [53] = 'A005' // Echo Slam
set udg_Ability [54] = 'A026' // Eclipse
set udg_Ability [55] = 'A028' // Epicenter
set udg_Ability [56] = 'A00G' // Global Silence
set udg_Ability [57] = 'A01E' // Nether Strike
set udg_Ability [58] = 'A00A' // Omni Slash
set udg_Ability [59] = 'A00W' // Permanent Invisibility
set udg_Ability [60] = 'A016' // Pulse Nova
set udg_Ability [61] = 'A01W' // Rupture
set udg_Ability [62] = 'A011' // War Path
set udg_Ability [63] = 'A02N' // Replicate
set udg_Ability [64] = 'A02P' // Disember
set udg_Ability [65] = 'A00V' // Permanent Invisibility (Main)
endfunction
//===========================================================================
function InitTrig_Abil_Set takes nothing returns nothing
set gg_trg_Abil_Set = CreateTrigger( )
call TriggerAddAction( gg_trg_Abil_Set, function Trig_Item_Set_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ITEM_SET_Actions takes nothing returns nothing
// Normal
set udg_Item [1] = 'I00W' // Adaptive Strike
set udg_Item [2] = 'I00V' // AfterShock
set udg_Item [3] = 'I00Y' // Aphotic shield
set udg_Item [4] = 'I00Z' // Back Stab
set udg_Item [5] = 'I010' // Backtrack
set udg_Item [6] = 'I011' // Battle Hunger
set udg_Item [7] = 'I012' // Besseker call
set udg_Item [8] = 'I013' // Blade Dance
set udg_Item [9] = 'I014' // Blade Fury
set udg_Item [10] = 'I015' // Blink Strike
set udg_Item [11] = 'A017' // Blood Bath
set udg_Item [12] = 'I016' // Blood Rage
set udg_Item [13] = 'I018' // Bristle Back
set udg_Item [14] = 'I019' // Burrow Strike
set udg_Item [15] = 'I01A' // Caustic Finale
set udg_Item [16] = 'I00X' // Charge Of Darkness
set udg_Item [17] = 'I01C' // Counter Helix
set udg_Item [18] = 'I01D' // Curse Of The Silence
set udg_Item [19] = 'I01E' // DEath Coil
set udg_Item [20] = 'I01F' // Diabolic Edict
set udg_Item [21] = 'I01L' // Empowering Haste
set udg_Item [22] = 'I01K' // Fissure
set udg_Item [23] = 'I01L' // Glaive Of Wisdom
set udg_Item [24] = 'I01M' // Greater Bash
set udg_Item [25] = '101O' // Head Shot
set udg_Item [26] = 'I01P' // Lightning Strom
set udg_Item [27] = 'I01B' // Lucent Beam
set udg_Item [28] = 'I01R' // Lunar Blessing
set udg_Item [29] = 'I01S' // Meat hook
set udg_Item [30] = 'I012' // quil Spray
set udg_Item [31] = 'I01X' // Rot
set udg_Item [32] = 'I01Z' // Sand Strom
set udg_Item [33] = 'I020' // Scatter Shot
set udg_Item [34] = 'I021' // Smoke Screen
set udg_Item [35] = 'I01Y' // Split Earth
set udg_Item [36] = 'I023' // Strygwyrs Thirts
set udg_Item [37] = 'I024' // Time Lock
set udg_Item [38] = 'I025' // Time Walk
set udg_Item [39] = 'I022' // Vicious Nassal
set udg_Item [40] = 'I028' // Wave Form
set udg_Item [41] = 'I026' // Flesh Heap
set udg_Item [42] = 'I02B' // Enchant Totem
set udg_Item [43] = 'I02C' // Froustmourne
set udg_Item [44] = 'I02D' // Healing WArd
set udg_Item [45] = 'I02E' // last Word
set udg_Item [46] = 'I02F' // Moon Glaive
set udg_Item [47] = 'I02G' // Morph
set udg_Item [48] = 'I021' // Take Aim
// uLtImAtE
set udg_Item [49] = 'I02J' // assassinate
set udg_Item [50] = 'I02K' // Borrowed Time
set udg_Item [51] = 'I02L' // Chronosphere
set udg_Item [52] = 'I02M' // Culling Blade
set udg_Item [53] = 'I01G' // Echo Slam
set udg_Item [54] = 'I01H' // Eclipse
set udg_Item [55] = 'I01J' // Epicenter
set udg_Item [56] = 'I01M' // Global Silence
set udg_Item [57] = 'I01T' // Nether Strike
set udg_Item [58] = 'I01U' // Omni Slash
set udg_Item [59] = 'I02H' // Permanent Invisibility
set udg_Item [60] = 'I01V' // Pulse Nova
set udg_Item [61] = 'I01Q' // Rupture
set udg_Item [62] = 'I027' // War Path
set udg_Item [63] = 'I029' // Replicate
set udg_Item [64] = 'I02A' // Disember
set udg_Item [65] = 'I02H' // Permanent Invisibility (Main)
endfunction
//===========================================================================
function InitTrig_ITEM_SET takes nothing returns nothing
set gg_trg_ITEM_SET = CreateTrigger( )
call TriggerAddAction( gg_trg_ITEM_SET, function Trig_ITEM_SET_Actions )
endfunction