Name | Type | is_array | initial_value |
Angle | real | No | |
Armageddon_Caster | group | No | |
Armageddon_lvl | real | No | |
Armageddon_Target | group | No | |
Blaze_Group | group | No | |
Blaze_Position | location | Yes | |
Cast_Effect | effect | Yes | |
Caster | unit | No | |
Caster_Position | location | No | |
DarkHeroKills | integer | No | |
Distance | integer | No | |
Druid_Position | location | Yes | |
DuelStartTimer | timer | No | |
DuelTimer | timer | No | |
DuelWarningTimer | timer | No | |
Duration | integer | No | |
EvilWeatherEffect1 | weathereffect | No | |
EvilWeatherEffect2 | weathereffect | No | |
Exploder | unit | Yes | |
FeralRage_Lvl | integer | Yes | |
Fire_Stream | unit | Yes | |
Fire_Stream_Group | group | No | |
FireClaws_Lvl | integer | Yes | |
FireGolem | unit | Yes | |
foodcap | boolean | No | |
FS_Buff_Group | group | No | |
FS_Damage | real | No | |
Golem | unit | Yes | |
GoodWeatherEffect2 | weathereffect | No | |
GoodWeatherLane1 | weathereffect | No | |
Hero_level | real | No | |
Humanform | abilcode | No | |
Hunger_Lvl | integer | Yes | |
Hurrican_Position | location | Yes | |
hurricane | unit | Yes | |
Javelin_Owner | player | No | |
Javelin_Poison | unitcode | No | |
Knockbacktimer | timer | No | |
LightHeroKills | integer | No | |
LocPoint1 | location | No | |
LocPoint2 | location | No | |
LocPoint3 | location | No | |
Maul_Lvl | integer | Yes | |
Number_of_Streams | integer | No | |
player1 | rect | No | |
player10 | rect | No | |
Player10HeroKills | integer | No | |
player11 | rect | No | |
Player11HeroKills | integer | No | |
player12 | rect | No | |
Player12HeroKills | integer | No | |
Player1HeroKills | integer | No | |
player2 | rect | No | |
Player2HeroKills | integer | No | |
player3 | rect | No | |
Player3HeroKills | integer | No | |
player4 | rect | No | |
Player4HeroKills | integer | No | |
player5 | rect | No | |
Player5HeroKills | integer | No | |
player6 | rect | No | |
Player6HeroKills | integer | No | |
player7 | rect | No | |
Player7HeroKills | integer | No | |
player8 | rect | No | |
Player8HeroKills | integer | No | |
player9 | rect | No | |
Player9HeroKills | integer | No | |
PoisonJavelin | unit | No | |
Rabies_Lvl | integer | Yes | |
Random_Items | real | No | |
Random_Number | real | No | |
Shockwave_Lvl | integer | Yes | |
TalentPoints | integer | No | |
Target | unit | No | |
Team1 | group | Yes | |
tempbuildloc | location | No | |
Valkerie | unitcode | No | |
Valkerie1 | unit | Yes | |
Valkerie2 | unit | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//***************************************************************************************************************
//* *
//* K N O C K B A C K *
//* Actual Code *
//* v1.02 *
//* *
//* By: Rising_Dusk *
//* *
//***************************************************************************************************************
library Knockback initializer KnockbackSystemInit
globals
//*********************************************************
//* These are the configuration constants for the system
//*
//* EffectLocation: Where on the unit the effect attaches
//* EffectPath_Water: What special effect to attach over water
//* EffectPath_Ground: What special effect to attach over ground
//* Dest_Radius: Radius around which destructs die
//*
private constant string EffectLocation = "origin"
private constant string EffectPath_Water = "MDX\\KnockbackWater.mdx"
private constant string EffectPath_Ground = "MDX\\KnockbackDust.mdx"
private constant real Dest_Radius = 180.
//*********************************************************
//* These are static constants used by the system and shouldn't be changed
//*
//* Timer: The timer that runs all of the effects for the spell
//* Counter: The counter for how many KB instances exist
//* Knockers: The array of all struct instances that exist
//* TimerInterval: The interval for the timer that gets run
//* Boolexpr: The boolean expression used for finding destructs
//* DestRect: The rect used to check for destructables
//*
private timer Timer = CreateTimer()
private integer Counter = 0
private integer array Knockers
private constant real TimerInterval = 0.05
private boolexpr Boolexpr
private rect DestRect = Rect(0,0,1,1)
//* Temporary variables used by the system
private real Temp1
private real Temp2
endglobals
//*********************************************************
//* Functions for the destructable destruction
private function KillDests_Check takes nothing returns boolean
local real x = GetDestructableX(GetFilterDestructable())
local real y = GetDestructableY(GetFilterDestructable())
return (Temp1-x)*(Temp1-x) + (Temp2-y)*(Temp2-y) <= Dest_Radius*Dest_Radius
endfunction
private function KillDests takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
//*********************************************************
//* Struct for the system, I recommend leaving it alone
private struct knocker
unit Target
effect KBEffect
integer FXMode
boolean KillDest
real Decrement
real Speed
real SinA
real CosA
public method checkterrain takes knocker n returns integer
local real x = GetUnitX(n.Target)
local real y = GetUnitY(n.Target)
if IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) then
return 1
elseif not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) then
return 2
endif
return 0
endmethod
static method create takes unit targ, real angle, real startspeed, real decrement, boolean killDestructables returns knocker
local knocker n = knocker.allocate()
set n.Target = targ
set n.FXMode = n.checkterrain(n)
if n.FXMode == 1 then
set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, EffectLocation)
elseif n.FXMode == 2 then
set n.KBEffect = AddSpecialEffectTarget(EffectPath_Water, n.Target, EffectLocation)
debug else
debug call BJDebugMsg("System Error (On Create): Unknown Terrain Type")
endif
set n.KillDest = killDestructables
set n.Decrement = decrement
set n.Speed = startspeed
set n.SinA = Sin(angle)
set n.CosA = Cos(angle)
return n
endmethod
private method onDestroy takes nothing returns nothing
call DestroyEffect(this.KBEffect)
endmethod
endstruct
//******************************************************************************
//* The system code itself.
private function Update takes nothing returns nothing
local unit u
local rect r
local knocker n = 0
local integer i = Counter - 1
local integer j = 0
local integer mode
local real speed
local real xi
local real yi
local real xf
local real yf
loop
exitwhen i < 0
set n = Knockers[i]
set u = n.Target
set mode = n.FXMode
set xi = GetUnitX(u)
set yi = GetUnitY(u)
if n.Speed <= 0 then
call n.destroy()
set Counter = Counter - 1
if Counter < 0 then
call PauseTimer(Timer)
set Counter = 0
else
set Knockers[i] = Knockers[Counter]
endif
else
set xf = xi + (n.Speed) * n.CosA
set yf = yi + (n.Speed) * n.SinA
call SetUnitPosition(u, xf, yf)
set n.FXMode = n.checkterrain(n)
if n.FXMode == 1 and mode == 2 then
call DestroyEffect(n.KBEffect)
set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, EffectLocation)
elseif n.FXMode == 2 and mode == 1 then
call DestroyEffect(n.KBEffect)
set n.KBEffect = AddSpecialEffectTarget(EffectPath_Water, n.Target, EffectLocation)
debug elseif n.FXMode == 0 then
debug call BJDebugMsg("System Error (In Update): Unknown Terrain Type")
endif
set n.Speed = n.Speed - n.Decrement
//* Destroy destructables if desired
if n.KillDest then
set Temp1 = GetUnitX(u)
set Temp2 = GetUnitY(u)
call SetRect(DestRect, xf-Dest_Radius, yf-Dest_Radius, xf+Dest_Radius, yf+Dest_Radius)
call EnumDestructablesInRect(DestRect, Boolexpr, function KillDests)
endif
endif
set i = i - 1
endloop
set u = null
endfunction
function KnockbackStop takes unit targ returns boolean
local integer i = Counter - 1
local knocker n = 0
local boolean b = false
loop
exitwhen i < 0
set n = Knockers[i]
if n.Target == targ then
call n.destroy(n)
set Counter = Counter - 1
if Counter < 0 then
call PauseTimer(Timer)
set Counter = 0
else
set Knockers[i] = Knockers[Counter]
endif
set b = true
endif
set i = i - 1
endloop
return b
endfunction
function IsKnockedBack takes unit targ returns boolean
local integer i = Counter - 1
local knocker n = 0
loop
exitwhen i < 0
set n = Knockers[i]
if n.Target == targ then
return true
endif
set i = i - 1
endloop
return false
endfunction
function KnockbackTarget takes unit targ, real angle, real startspeed, real decrement, boolean killDestructables returns boolean
local knocker n = 0
//* Protect users from themselves
if decrement == 0 or startspeed == 0 or targ == null then
debug call BJDebugMsg("System Error: Invalid Starting Conditions")
return false
endif
set n = knocker.create(targ, angle*0.01745328, startspeed*TimerInterval, decrement*TimerInterval, killDestructables)
if Counter == 0 then
call TimerStart(Timer, TimerInterval, true, function Update)
endif
set Knockers[Counter] = n
set Counter = Counter + 1
return true
endfunction
private function KnockbackSystemInit takes nothing returns nothing
set Boolexpr = Condition(function KillDests_Check)
endfunction
public function InitTrig takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=1
//TESH.alwaysfold=0
library Knockback initializer Init
// **************************************************************************
// ** **
// ** Knockback(Ex) **
// ** ————————————— **
// ** A function made for efficient knockbacking **
// ** **
// ** By: Silvenon **
// **************************************************************************
//Credits to PitzerMike for this function//
//=======================================//
globals
private constant integer DUMMY_ID = 'h000'
endglobals
private function TreeFilter takes nothing returns boolean
local destructable d = GetFilterDestructable()
local boolean i = IsDestructableInvulnerable(d)
local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, GetWidgetX(d), GetWidgetY(d), 0)
local boolean result = false
call UnitAddAbility(u, 'Ahrl')
if i then
call SetDestructableInvulnerable(d, false)
endif
set result = IssueTargetOrder(u, "harvest", d)
call RemoveUnit(u)
if i then
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope KnockbackSpell
globals
private unit TempUnit = null
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'kn0ck'
endfunction
private function GroupCheck takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
private function Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local unit s
local unit d
local real a
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local group g = CreateGroup()
local boolexpr b = Condition(function GroupCheck)
set TempUnit = u
call GroupEnumUnitsInRange(g, GetUnitX(t), GetUnitY(t), 200, b)
loop
set s = FirstOfGroup(g)
exitwhen s == null
set a = 57.29582 * Atan2(GetUnitY(s) - y, GetUnitX(s) - x)
call UnitDamageTarget(u, s, 200., false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
call KnockbackTarget(s, a, 900, 40, true)
call GroupRemoveUnit(g, s)
endloop
call GroupClear(g)
call DestroyGroup(g)
call DestroyBoolExpr(b)
set u = null
set t = null
set d = null
set s = null
set g = null
set b = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope